Commit c5bfbd51 authored by Ghislain MARY's avatar Ghislain MARY

Some CMake cleaning.

parent 708ce75e
......@@ -36,21 +36,21 @@ include(GNUInstallDirs)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if (NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX)
if(NOT CMAKE_INSTALL_RPATH AND CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
message("Setting install rpath to ${CMAKE_INSTALL_RPATH}")
message(STATUS "Setting install rpath to ${CMAKE_INSTALL_RPATH}")
endif()
if(ENABLE_MBEDTLS)
find_package(MbedTLS)
if(MBEDTLS_FOUND)
message("Use mbedTLS")
message(STATUS "Using mbedTLS")
endif()
endif()
if(ENABLE_POLARSSL AND NOT MBEDTLS_FOUND)
find_package(PolarSSL REQUIRED)
if(POLARSSL_FOUND)
message("Use polarSSL")
message(STATUS "Using polarSSL")
if(CTR_DRBG_FREE)
set(HAVE_CTR_DRGB_FREE 1)
endif()
......@@ -58,10 +58,10 @@ if(ENABLE_POLARSSL AND NOT MBEDTLS_FOUND)
endif()
if(HAVE_SSL_GET_DTLS_SRTP_PROTECTION_PROFILE)
message("DTLS SRTP available")
message(STATUS "DTLS SRTP available")
set(HAVE_DTLS_SRTP 1)
else()
message("DTLS SRTP not available")
message(STATUS "DTLS SRTP not available")
endif()
if(MBEDTLS_FOUND)
......@@ -155,13 +155,13 @@ configure_file(cmake/BcToolboxConfig.cmake.in
@ONLY
)
set(ConfigPackageLocation share/${PROJECT_NAME}/cmake)
set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake")
install(EXPORT ${EXPORT_TARGETS_NAME}Targets
FILE BcToolboxTargets.cmake
DESTINATION ${ConfigPackageLocation}
DESTINATION ${CONFIG_PACKAGE_LOCATION}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/BcToolboxConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/BcToolboxConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
DESTINATION ${CONFIG_PACKAGE_LOCATION}
)
......@@ -55,7 +55,7 @@ endif()
if("${CPACK_GENERATOR}" STREQUAL "RPM" OR "${CPACK_GENERATOR}" STREQUAL "DEB")
if (NOT CPACK_PACKAGING_INSTALL_PREFIX AND CMAKE_INSTALL_PREFIX)
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
message("Setting packaging install prefix to ${CPACK_PACKAGING_INSTALL_PREFIX}")
message(STATUS "Setting packaging install prefix to ${CPACK_PACKAGING_INSTALL_PREFIX}")
endif()
endif()
......
......@@ -31,7 +31,6 @@ endforeach()
set(BCTOOLBOX_HEADER_FILES ${BCTOOLBOX_HEADER_FILES} PARENT_SCOPE)
install(FILES ${BCTOOLBOX_HEADER_FILES}
DESTINATION include/bctoolbox
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bctoolbox
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
......@@ -35,18 +35,21 @@ if(POLARSSL_FOUND)
endif()
endif()
add_library(bctoolbox-objects OBJECT ${BCTOOLBOX_HEADERS_FILES} ${BCTOOLBOX_SOURCE_FILES})
set_target_properties(bctoolbox-objects PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
if(ENABLE_STATIC)
add_library(bctoolbox-static STATIC ${BCTOOLBOX_HEADER_FILES} ${BCTOOLBOX_SOURCE_FILES})
add_library(bctoolbox-static STATIC $<TARGET_OBJECTS:bctoolbox-objects>)
set_target_properties(bctoolbox-static PROPERTIES OUTPUT_NAME bctoolbox)
endif()
if(ENABLE_SHARED)
add_library(bctoolbox SHARED ${BCTOOLBOX_HEADER_FILES} ${BCTOOLBOX_SOURCE_FILES})
add_library(bctoolbox SHARED $<TARGET_OBJECTS:bctoolbox-objects>)
set_target_properties(bctoolbox PROPERTIES VERSION 0.0.0 SOVERSION 0)
set_target_properties(bctoolbox PROPERTIES LINKER_LANGUAGE "CXX")
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/bctoolbox.pdb
DESTINATION bin
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
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