aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-05-06 22:02:39 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-05-06 22:02:39 -0400
commit2cee801979bfbcb3b0e53f592ce8c779b57cb679 (patch)
tree81af307eac4be697a85e5f138e42a502b66df382
parentf533694023133552d0d42933d779c95a5854343f (diff)
Ensure static and dynamic libs get same args
-rw-r--r--CMakeLists.txt21
1 files changed, 13 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2a3e30..8505d8e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -227,11 +227,12 @@ if(NC_DISABLE_INPUT_VALIDATION)
list(APPEND NC_PROJ_DEFINTIONS NC_INPUT_VALIDATION_OFF)
endif()
+set(_NC_COMPILE_OPTS)
+
#setup flags for windows compilation
if(MSVC)
-
- #global windows cl flags
- target_compile_options(${_NC_PROJ_NAME} PRIVATE
+
+ list(APPEND _NC_COMPILE_OPTS
/sdl #enable additional security checks
/TC #compile as c
/GS #buffer security check
@@ -248,7 +249,7 @@ if(MSVC)
$<$<CONFIG:Debug>:/WX> #warnings as errors (only for our project)
$<$<CONFIG:Debug>:/Zi> #enable rich debug info
$<$<CONFIG:Debug>:/Zo>
- )
+ )
#set build macros
list(APPEND NC_PROJ_DEFINTIONS
@@ -259,13 +260,14 @@ if(MSVC)
#configure gcc flags
elseif(CMAKE_COMPILER_IS_GNUCC)
- target_compile_options(${_NC_PROJ_NAME} PRIVATE -Wextra -fstack-protector)
+ list(APPEND _NC_COMPILE_OPTS
+ -Wextra
+ -fstack-protector
+ )
#if debug build enable additional debug flags
if(build_type STREQUAL "debug")
- target_compile_options(
- ${_NC_PROJ_NAME}
- PRIVATE
+ list(APPEND _NC_COMPILE_OPTS
-g
-Og
@@ -276,6 +278,9 @@ elseif(CMAKE_COMPILER_IS_GNUCC)
endif()
endif()
+target_compile_options(${_NC_PROJ_NAME} PRIVATE ${_NC_COMPILE_OPTS})
+target_compile_options(${_NC_PROJ_NAME}_static PRIVATE ${_NC_COMPILE_OPTS})
+
#############################################
#
# Build/link monocypher