ports/devel/cpp-hocon/files/patch-lib_CMakeLists.txt

32 lines
1.5 KiB
Text

--- lib/CMakeLists.txt.orig 2016-09-23 20:45:10 UTC
+++ lib/CMakeLists.txt
@@ -75,20 +75,23 @@ set(PROJECT_SOURCES
## Without the intermediate target, unexported symbols can't be tested.
add_library(libprojectsrc OBJECT ${PROJECT_SOURCES})
set_target_properties(libprojectsrc PROPERTIES POSITION_INDEPENDENT_CODE true)
-
-add_library(lib${PROJECT_NAME} $<TARGET_OBJECTS:libprojectsrc>)
-set_target_properties(lib${PROJECT_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
-target_link_libraries(lib${PROJECT_NAME}
+if(CPP_HOCON_SHARED)
+ add_library(${PROJECT_NAME} SHARED $<TARGET_OBJECTS:libprojectsrc>)
+else()
+ add_library(${PROJECT_NAME} $<TARGET_OBJECTS:libprojectsrc>)
+endif()
+set_target_properties(${PROJECT_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
+target_link_libraries(${PROJECT_NAME}
${LEATHERMAN_LIBRARIES}
${Boost_LIBRARIES}
)
# Generate the export header for restricting symbols exported from the library.
# Restricting symbols has several advantages, noted at https://gcc.gnu.org/wiki/Visibility.
-symbol_exports(lib${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/inc/hocon/export.h")
+symbol_exports(${PROJECT_NAME} "${CMAKE_CURRENT_LIST_DIR}/inc/hocon/export.h")
# This correctly handles DLL installation on Windows.
-leatherman_install(lib${PROJECT_NAME})
+leatherman_install(${PROJECT_NAME})
install(DIRECTORY inc/hocon DESTINATION include)
add_subdirectory(tests)