diff options
author | Jeffrey Walton <noloader@gmail.com> | 2016-09-14 06:33:34 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2016-09-14 06:33:34 -0400 |
commit | c70f01d7b3c7e7a6dfece53a43cfc4cd1e56c875 (patch) | |
tree | 69a8fff6da78d04c0150196d8ee0fb5023f8bde2 | |
parent | 1204d3dfcc13ba6feba0e0a68938dea3567ff6f3 (diff) | |
download | cryptopp-git-c70f01d7b3c7e7a6dfece53a43cfc4cd1e56c875.tar.gz |
Relocate first PIC code to just after Windows options. Remove second PIC code based on SIZEOF_POINTER since it only managed to set for x86_64
-rw-r--r-- | CMakeLists.txt | 70 |
1 files changed, 22 insertions, 48 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ff66a422..8236912f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,28 +36,6 @@ set(CRYPTOPP_DATA_DIR "" CACHE PATH "Crypto++ test data directory") # Stop hiding the damn output...
set(CMAKE_VERBOSE_MAKEFILE on)
-# Enable PIC for all targets except Windows and 32-bit x86.
-# Avoid on 32-bit x86 due to register pressures.
-if (NOT (WINDOWS OR WINDOWS_STORE OR WINDOWS_PHONE))
-
- set (UNAME_CMD "uname")
- set (UNAME_ARG "-m")
- execute_process(COMMAND ${UNAME_CMD} ${UNAME_ARG}
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- RESULT_VARIABLE UNAME_RESULT
- OUTPUT_VARIABLE UNAME_MACHINE)
-
- # Use Regex; match i386, i486, i586 and i686
- if (NOT (${UNAME_MACHINE} MATCHES "i.86"))
- # message(STATUS "Setting -fPIC for machine ${UNAME_MACHINE}")
- if (CMAKE_VERSION VERSION_LESS 2.8.12)
- add_definitions(-fPIC)
- else()
- add_compile_options(-fPIC)
- endif()
- endif()
-endif()
-
# Don't use RPATH's. The resulting binary could fail a security audit.
if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
set(CMAKE_MACOSX_RPATH 0)
@@ -95,6 +73,28 @@ if(WINDOWS_STORE OR WINDOWS_PHONE) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FI\"winapifamily.h\"" )
endif()
+# Enable PIC for all targets except Windows and 32-bit x86.
+# Avoid on 32-bit x86 due to register pressures.
+if (NOT (WINDOWS OR WINDOWS_STORE OR WINDOWS_PHONE))
+
+ set (UNAME_CMD "uname")
+ set (UNAME_ARG "-m")
+ execute_process(COMMAND ${UNAME_CMD} ${UNAME_ARG}
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ RESULT_VARIABLE UNAME_RESULT
+ OUTPUT_VARIABLE UNAME_MACHINE)
+
+ # Use Regex; match i386, i486, i586 and i686
+ if (NOT (${UNAME_MACHINE} MATCHES "i.86"))
+ # message(STATUS "Setting -fPIC for machine ${UNAME_MACHINE}")
+ if (CMAKE_VERSION VERSION_LESS 2.8.12)
+ add_definitions(-fPIC)
+ else()
+ add_compile_options(-fPIC)
+ endif()
+ endif()
+endif()
+
#============================================================================
# Sources & headers
#============================================================================
@@ -183,32 +183,6 @@ if (BUILD_SHARED) endif()
endif()
-# Set PIC
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Enables -fPIC on all 64-bit platforms
- if(NOT CMAKE_VERSION VERSION_LESS 2.8.9) # POSITION_INDEPENDENT_CODE support
- set_target_properties(cryptopp-object PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
- elseif(NOT CMAKE_VERSION VERSION_LESS 2.8.8) # Object library support
- get_target_property(flags_old cryptopp-object COMPILE_FLAGS)
- set_target_properties(cryptopp-object PROPERTIES COMPILE_FLAGS "${flags_old} -fPIC")
- else()
- if (BUILD_STATIC)
- get_target_property(flags_old_static cryptopp-static COMPILE_FLAGS)
- if(NOT flags_old_static)
- set(flags_old_static "")
- endif()
- set_target_properties(cryptopp-static PROPERTIES COMPILE_FLAGS "${flags_old_static} -fPIC")
- endif()
- if (BUILD_SHARED)
- get_target_property(flags_old_shared cryptopp-shared COMPILE_FLAGS)
- if(NOT flags_old_shared)
- set(flags_old_shared "")
- endif()
- set_target_properties(cryptopp-shared PROPERTIES COMPILE_FLAGS "${flags_old_shared} -fPIC")
- endif()
- endif()
-endif()
-
# Set filenames for targets to be "cryptopp"
if(NOT MSVC)
set(COMPAT_VERSION ${cryptopp_VERSION_MAJOR}.${cryptopp_VERSION_MINOR})
|