The first is a really bad way to globally add and duplicate EVERYTHING for EVERYTHING and is necessary as the proper way is being done below by calling the cryptopp_target_compile_properties function for static, shared, etc targets.
A few issues are actually inside the function `` itself:
COMPILE_FLAGS: This property is deprecated. Use the COMPILE_OPTIONS property instead.
Both COMPILE_OPTIONS and COMPILE_DEFINITIONS properties take a semicolon separated list (cmake list), no need to replace the semicolon with spaces.
for setting the COMPILE_DEFINITIONS option, the PROP_STR is not even being used :-)
Suggestion for fix:
Therefore, the suggestion is to remove the section of code adding the options and definitions globally, and cleanup the function that does it per target as following:
function(cryptopp_target_compile_properties target)
# CMake >= 2.8.12
if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
target_compile_options(${target} PUBLIC ${CRYPTOPP_COMPILE_OPTIONS})
else()
set_target_properties(${target} PROPERTIES COMPILE_OPTIONS ${CRYPTOPP_COMPILE_OPTIONS})
endif()
# CMake >= 2.8.11
if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.11")
target_compile_definitions(${target} PUBLIC ${CRYPTOPP_COMPILE_DEFINITIONS})
else()
set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS ${CRYPTOPP_COMPILE_DEFINITIONS})
endif()
endfunction()
Compiler definitions (e.g.
-DCRYPTOPP_DATA_DIR=...
) and options (e.g./DWIN32
and/D_WINDOWS
) are being added here:and here
The first is a really bad way to globally add and duplicate EVERYTHING for EVERYTHING and is necessary as the proper way is being done below by calling the
cryptopp_target_compile_properties
function for static, shared, etc targets.A few issues are actually inside the function `` itself:
Suggestion for fix: Therefore, the suggestion is to remove the section of code adding the options and definitions globally, and cleanup the function that does it per target as following: