Commit 8e192159 authored by Ghislain MARY's avatar Ghislain MARY

CMake fixes for static library build.

parent 15996291
...@@ -129,9 +129,9 @@ include(CMakePackageConfigHelpers) ...@@ -129,9 +129,9 @@ include(CMakePackageConfigHelpers)
export(EXPORT ${EXPORT_TARGETS_NAME}Targets export(EXPORT ${EXPORT_TARGETS_NAME}Targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/BelrTargets.cmake" FILE "${CMAKE_CURRENT_BINARY_DIR}/BelrTargets.cmake"
) )
configure_file(cmake/BelrConfig.cmake configure_file(cmake/BelrConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/BelrConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/BelrConfig.cmake"
COPYONLY @ONLY
) )
set(ConfigPackageLocation share/Belr/cmake) set(ConfigPackageLocation share/Belr/cmake)
install(EXPORT ${EXPORT_TARGETS_NAME}Targets install(EXPORT ${EXPORT_TARGETS_NAME}Targets
...@@ -139,6 +139,6 @@ install(EXPORT ${EXPORT_TARGETS_NAME}Targets ...@@ -139,6 +139,6 @@ install(EXPORT ${EXPORT_TARGETS_NAME}Targets
DESTINATION ${ConfigPackageLocation} DESTINATION ${ConfigPackageLocation}
) )
install(FILES install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/BelrConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/BelrConfig.cmake"
DESTINATION ${ConfigPackageLocation} DESTINATION ${ConfigPackageLocation}
) )
...@@ -37,5 +37,11 @@ if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) ...@@ -37,5 +37,11 @@ if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
else() else()
set(BELR_INCLUDE_DIRS "${BELR_CMAKE_DIR}/../../../include") set(BELR_INCLUDE_DIRS "${BELR_CMAKE_DIR}/../../../include")
endif() endif()
set(BELR_LIBRARIES belr)
if(@ENABLE_SHARED@)
set(BELR_LIBRARIES belr)
else()
set(BELR_LIBRARIES belr-static)
endif()
set(BELR_FOUND 1) set(BELR_FOUND 1)
...@@ -20,12 +20,18 @@ ...@@ -20,12 +20,18 @@
# #
############################################################################ ############################################################################
if(ENABLE_SHARED)
set(BELR_LIBRARIES_FOR_TOOLS belr)
else()
set(BELR_LIBRARIES_FOR_TOOLS belr-static)
endif()
foreach(EXECTUABLE belr-parse belr-demo) foreach(EXECTUABLE belr-parse belr-demo)
set(SOURCE_FILES_CXX ${EXECTUABLE}.cc) set(SOURCE_FILES_CXX ${EXECTUABLE}.cc)
apply_compile_flags(SOURCE_FILES_CXX "CPP" "CXX") apply_compile_flags(SOURCE_FILES_CXX "CPP" "CXX")
add_executable(${EXECTUABLE} ${SOURCE_FILES_CXX}) add_executable(${EXECTUABLE} ${SOURCE_FILES_CXX})
set_target_properties(${EXECTUABLE} PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(${EXECTUABLE} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${EXECTUABLE} belr) target_link_libraries(${EXECTUABLE} ${BELR_LIBRARIES_FOR_TOOLS})
if(APPLE) if(APPLE)
set_target_properties(${EXECTUABLE} PROPERTIES LINK_FLAGS "-stdlib=libc++") set_target_properties(${EXECTUABLE} PROPERTIES LINK_FLAGS "-stdlib=libc++")
endif() 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