Browse Source

Fix package export

Alexey Edelev 5 years ago
parent
commit
f177d4d40e
2 changed files with 5 additions and 3 deletions
  1. 1 2
      CMakeLists.txt
  2. 4 1
      microjson.cpp

+ 1 - 2
CMakeLists.txt

@@ -38,10 +38,9 @@ configure_package_config_file(
 
 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_CONFIG}.cmake" DESTINATION "${TARGET_CMAKE_DIR}" COMPONENT dev)
 
+export(PACKAGE ${TARGET})
 export(TARGETS ${TARGET} FILE ${TARGET_EXPORT}.cmake)
 
-set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_PREFIX_PATH})
-
 if(DEFINED $ENV{MICROJSON_MAKE_TESTS})
     set(MICROJSON_MAKE_TESTS $ENV{MICROJSON_MAKE_TESTS})
 elseif(NOT DEFINED MICROJSON_MAKE_TESTS)

+ 4 - 1
microjson.cpp

@@ -30,7 +30,10 @@
 #ifdef MICROJSON_DEBUG
     #define microjsonDebug std::cout
 #else
-    struct microjsonNull : public std::ostream {};
+    struct microjsonNull : public std::ostream {
+        class nullBuffer : public std::streambuf {};
+        microjsonNull() : std::ostream(new nullBuffer) {}
+    };
     static microjsonNull nullout;
     #define microjsonDebug nullout
 #endif