From adfb2bf72257c4d622f4be8f897c5ddafa4e58ae Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Wed, 9 Sep 2015 05:15:06 -0500 Subject: [PATCH] Do not build lib-objects targets if we are just building static libs. This confuses some cmake targets. --- CMakeLists.txt | 2 ++ crypto/CMakeLists.txt | 16 ++++++++-------- ssl/CMakeLists.txt | 17 ++++++++--------- tls/CMakeLists.txt | 16 ++++++++-------- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e4c000..2aed0c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,8 @@ add_definitions(-DLIBRESSL_INTERNAL) add_definitions(-DOPENSSL_NO_HW_PADLOCK) add_definitions(-DOPENSSL_NO_ASM) +set(CMAKE_POSITION_INDEPENDENT_CODE true) + if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") add_definitions(-Wno-pointer-sign) endif() diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 950aa60..0e5d0fc 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -638,16 +638,16 @@ if(NOT HAVE_TIMINGSAFE_MEMCMP) set(CRYPTO_SRC ${CRYPTO_SRC} compat/timingsafe_memcmp.c) endif() -add_library(crypto-objects OBJECT ${CRYPTO_SRC}) -set_property(TARGET crypto-objects PROPERTY POSITION_INDEPENDENT_CODE 1) -add_library(crypto STATIC $) -set(CRYPTO_TARGETS crypto) - if (BUILD_SHARED) + add_library(crypto-objects OBJECT ${CRYPTO_SRC}) + add_library(crypto STATIC $) add_library(crypto-shared SHARED $) set_target_properties(crypto-shared PROPERTIES OUTPUT_NAME crypto) - set_target_properties(crypto-shared PROPERTIES VERSION ${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION}) - set(CRYPTO_TARGETS ${CRYPTO_TARGETS} crypto-shared) + set_target_properties(crypto-shared PROPERTIES VERSION + ${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION}) + install(TARGETS crypto crypto-shared DESTINATION lib) +else() + add_library(crypto STATIC ${CRYPTO_SRC}) + install(TARGETS crypto DESTINATION lib) endif() -install(TARGETS ${CRYPTO_TARGETS} DESTINATION lib) diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index 7d1140e..5d8dd5e 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -50,16 +50,15 @@ set( t1_srvr.c ) -add_library(ssl-objects OBJECT ${SSL_SRC}) -set_property(TARGET ssl-objects PROPERTY POSITION_INDEPENDENT_CODE 1) -add_library(ssl STATIC $) -set(SSL_TARGETS ssl) - if (BUILD_SHARED) + add_library(ssl-objects OBJECT ${SSL_SRC}) + add_library(ssl STATIC $) add_library(ssl-shared SHARED $) set_target_properties(ssl-shared PROPERTIES OUTPUT_NAME ssl) - set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION} SOVERSION ${SSL_MAJOR_VERSION}) - set(SSL_TARGETS ${SSL_TARGETS} ssl-shared) + set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION} + SOVERSION ${SSL_MAJOR_VERSION}) + install(TARGETS ssl ssl-shared DESTINATION lib) +else() + add_library(ssl STATIC ${SSL_SRC}) + install(TARGETS ssl DESTINATION lib) endif() - -install(TARGETS ${SSL_TARGETS} DESTINATION lib) diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt index 396780c..68ab3f4 100644 --- a/tls/CMakeLists.txt +++ b/tls/CMakeLists.txt @@ -19,16 +19,16 @@ if(NOT HAVE_STRCASECMP) set(TLS_SRC ${TLS_SRC} strsep.c) endif() -add_library(tls-objects OBJECT ${TLS_SRC}) -set_property(TARGET tls-objects PROPERTY POSITION_INDEPENDENT_CODE 1) -add_library(tls STATIC $) -set(TLS_TARGETS tls) - if (BUILD_SHARED) + add_library(tls-objects OBJECT ${TLS_SRC}) + add_library(tls STATIC $) add_library(tls-shared SHARED $) set_target_properties(tls-shared PROPERTIES OUTPUT_NAME tls) - set_target_properties(tls-shared PROPERTIES VERSION ${TLS_VERSION} SOVERSION ${TLS_MAJOR_VERSION}) - set(TLS_TARGETS ${TLS_TARGETS} tls-shared) + set_target_properties(tls-shared PROPERTIES VERSION ${TLS_VERSION} + SOVERSION ${TLS_MAJOR_VERSION}) + install(TARGETS tls tls-shared DESTINATION lib) +else() + add_library(tls STATIC ${TLS_SRC}) + install(TARGETS tls DESTINATION lib) endif() -install(TARGETS ${TLS_TARGETS} DESTINATION lib)