aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 6 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index abb700c..caed929 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
project(STASIS C)
include(GNUInstallDirs)
-set(nix_cflags -Wall -Wextra -fPIC)
+set(nix_cflags -Wall -Wextra -fPIC -D_GNU_SOURCE)
set(win_cflags /Wall)
set(CMAKE_C_STANDARD 99)
find_package(LibXml2)
@@ -11,13 +11,16 @@ link_libraries(CURL::libcurl)
link_libraries(LibXml2::LibXml2)
include_directories(${LIBXML2_INCLUDE_DIR})
+option(FORTIFY_SOURCE OFF)
+if (FORTIFY_SOURCE)
+ set(nix_cflags ${nix_cflags} -O -D_FORTIFY_SOURCE=1)
+endif ()
+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- message("gnu options")
add_compile_options(${nix_cflags})
elseif (CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(${nix_cflags})
elseif (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
- message("microsoft visual c options")
add_compile_options(${win_cflags})
endif()