summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorHeinrich Janzing <heinrich.janzing@dentsplysirona.com>2017-01-05 09:19:19 +0100
committerHeinrich Janzing <heinrich.janzing@dentsplysirona.com>2017-01-05 09:19:19 +0100
commit3c77873b0ece124aa0e3756fef1a4cf76af6b010 (patch)
treeb387945f037c8a55a2be4ca42de3cccc409da6a6 /CMakeLists.txt
parentbccc6443c4d4d611066c2de4c17109380cf97704 (diff)
downloadcryptopp-git-3c77873b0ece124aa0e3756fef1a4cf76af6b010.tar.gz
CMake: allow disabling the intermediate objects target (cryptopp-object).
Targets with only object inputs do not work correctly with some generators (like Xcode, see issue #355). Defining these directly in terms of the source code files (rather than a reused set of object files) allows correct builds in such cases. This can now be controlled through a new option USE_INTERMEDIATE_OBJECTS_TARGET which defaults to ON.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 9 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 641fb8f8..c9a122a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,6 +35,12 @@ option(BUILD_STATIC "Build static library" ON)
option(BUILD_SHARED "Build shared library" ON)
option(BUILD_TESTING "Build library tests" ON)
option(BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
+option(USE_INTERMEDIATE_OBJECTS_TARGET "Use a common intermediate objects target for the static and shared library targets" ON)
+
+if(CMAKE_VERSION VERSION_LESS 2.8.8 AND USE_INTERMEDIATE_OBJECTS_TARGET)
+ message(STATUS "Forcing USE_INTERMEDIATE_OBJECTS_TARGET to OFF - requires CMake >= 2.8.8")
+ set(USE_INTERMEDIATE_OBJECTS_TARGET OFF CACHE BOOL "Use a common intermediate objects target for the static and shared library targets" FORCE)
+endif()
option(DISABLE_ASM "Disable ASM" OFF)
option(DISABLE_SSSE3 "Disable SSSE3" OFF)
@@ -237,12 +243,12 @@ if(CMAKE_VERSION VERSION_LESS 2.8.12)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
endif()
-if(NOT CMAKE_VERSION VERSION_LESS 2.8.8)
+if(USE_INTERMEDIATE_OBJECTS_TARGET)
add_library(cryptopp-object OBJECT ${cryptopp_SOURCES})
endif()
if (BUILD_STATIC)
- if(NOT CMAKE_VERSION VERSION_LESS 2.8.8)
+ if(USE_INTERMEDIATE_OBJECTS_TARGET)
add_library(cryptopp-static STATIC $<TARGET_OBJECTS:cryptopp-object>)
else()
add_library(cryptopp-static STATIC ${cryptopp_SOURCES})
@@ -254,7 +260,7 @@ if (BUILD_STATIC)
endif()
if (BUILD_SHARED)
- if(NOT CMAKE_VERSION VERSION_LESS 2.8.8)
+ if(USE_INTERMEDIATE_OBJECTS_TARGET)
add_library(cryptopp-shared SHARED $<TARGET_OBJECTS:cryptopp-object>)
else()
add_library(cryptopp-shared SHARED ${cryptopp_SOURCES})