Commit 3207a12e authored by Ghislain MARY's avatar Ghislain MARY

CMake fixes for static library build.

parent 0967e5fb
......@@ -144,9 +144,9 @@ include(CMakePackageConfigHelpers)
export(EXPORT ${EXPORT_TARGETS_NAME}Targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/BelcardTargets.cmake"
)
configure_file(cmake/BelcardConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/BelcardConfig.cmake"
COPYONLY
configure_file(cmake/BelcardConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/BelcardConfig.cmake"
@ONLY
)
set(ConfigPackageLocation share/Belcard/cmake)
install(EXPORT ${EXPORT_TARGETS_NAME}Targets
......@@ -154,6 +154,6 @@ install(EXPORT ${EXPORT_TARGETS_NAME}Targets
DESTINATION ${ConfigPackageLocation}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/BelcardConfig.cmake"
DESTINATION ${ConfigPackageLocation}
"${CMAKE_CURRENT_BINARY_DIR}/BelcardConfig.cmake"
DESTINATION ${ConfigPackageLocation}
)
......@@ -44,10 +44,14 @@ else()
set(BELCARD_INCLUDE_DIRS "${BELCARD_CMAKE_DIR}/../../../include")
endif()
if(@ENABLE_SHARED@)
set(BELCARD_LIBRARIES belcard)
else()
set(BELCARD_LIBRARIES belcard-static)
endif()
if(BELR_FOUND)
list(APPEND BELCARD_INCLUDE_DIRS ${BELR_INCLUDE_DIRS})
list(APPEND BELCARD_LIBRARIES ${BELR_LIBRARIES})
endif()
set(BELCARD_LIBRARIES belcard)
set(BELCARD_FOUND 1)
......@@ -20,6 +20,12 @@
#
############################################################################
if(ENABLE_SHARED)
set(BELCARD_LIBRARIES_FOR_TESTER belcard)
else()
set(BELCARD_LIBRARIES_FOR_TESTER belcard-static)
endif()
set(HEADER_FILES_CXX belcard-tester.hpp)
set(SOURCE_FILES_CXX
belcard-addressing-tester.cpp
......@@ -41,7 +47,7 @@ apply_compile_flags(SOURCE_FILES_CXX "CPP" "CXX")
add_executable(belcard-tester ${SOURCE_FILES_CXX} ${HEADER_FILES_CXX})
set_target_properties(belcard-tester PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(belcard-tester PUBLIC ${BCTOOLBOX_TESTER_INCLUDE_DIRS})
target_link_libraries(belcard-tester belcard ${BCTOOLBOX_TESTER_LIBRARIES})
target_link_libraries(belcard-tester ${BELCARD_LIBRARIES_FOR_TESTER} ${BCTOOLBOX_TESTER_LIBRARIES})
if(APPLE)
set_target_properties(belcard-tester PROPERTIES LINK_FLAGS "-stdlib=libc++")
......
......@@ -20,12 +20,18 @@
#
############################################################################
if(ENABLE_SHARED)
set(BELCARD_LIBRARIES_FOR_TOOLS belcard)
else()
set(BELCARD_LIBRARIES_FOR_TOOLS belcard-static)
endif()
foreach(EXECTUABLE belcard-folder belcard-unfolder belcard-parser)
set(SOURCE_FILES_CXX ${EXECTUABLE}.cpp)
apply_compile_flags(SOURCE_FILES_CXX "CPP" "CXX")
add_executable(${EXECTUABLE} ${SOURCE_FILES_CXX})
set_target_properties(${EXECTUABLE} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${EXECTUABLE} belcard)
target_link_libraries(${EXECTUABLE} ${BELCARD_LIBRARIES_FOR_TOOLS})
if(APPLE)
set_target_properties(${EXECTUABLE} PROPERTIES LINK_FLAGS "-stdlib=libc++")
endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment