From 4b87e9cdcb24d3b979f4ceb8bca39fd99f7f7f1d Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Mon, 3 Jul 2017 22:07:38 -0700 Subject: [PATCH] [libconfig] fix guards --- ports/libconfig/CMakeLists.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ports/libconfig/CMakeLists.txt b/ports/libconfig/CMakeLists.txt index 878e705339..1ba4adaae0 100644 --- a/ports/libconfig/CMakeLists.txt +++ b/ports/libconfig/CMakeLists.txt @@ -48,6 +48,20 @@ install( ARCHIVE DESTINATION lib ) -if(NOT DISABLE_INSTALL_HEADERS) - install(FILES lib/libconfig.h++ lib/libconfig.h DESTINATION include) +file(READ lib/libconfig.h++ LIBCONFIGXX_H) +file(READ lib/libconfig.h LIBCONFIG_H) + +if(BUILD_SHARED_LIBS) + string(REPLACE "defined(LIBCONFIGXX_EXPORTS)" "1" LIBCONFIGXX_H "${LIBCONFIGXX_H}") + string(REPLACE "defined(LIBCONFIG_EXPORTS)" "1" LIBCONFIG_H "${LIBCONFIGXX_H}") +else() + string(REPLACE "defined(LIBCONFIGXX_STATIC)" "1" LIBCONFIGXX_H "${LIBCONFIGXX_H}") + string(REPLACE "defined(LIBCONFIG_STATIC)" "1" LIBCONFIG_H "${LIBCONFIG_H}") +endif() + +file(WRITE ${PROJECT_BINARY_DIR}/libconfig.h++ ${LIBCONFIGXX_H}) +file(WRITE ${PROJECT_BINARY_DIR}/libconfig.h ${LIBCONFIG_H}) + +if(NOT DISABLE_INSTALL_HEADERS) + install(FILES ${PROJECT_BINARY_DIR}/libconfig.h++ ${PROJECT_BINARY_DIR}/libconfig.h DESTINATION include) endif()