From 7a1344bfcb54cf32cf66a006d5ddf0ddfa1ea9ef Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Thu, 1 Oct 2020 13:35:53 +0200 Subject: [PATCH] cmake variable NG_COMPILE_FLAGS to set additional compile options --- CMakeLists.txt | 2 ++ cmake/SuperBuild.cmake | 1 + libsrc/core/CMakeLists.txt | 2 ++ 3 files changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c756c441..7916e6ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,8 @@ option( BUILD_FOR_CONDA "Link python libraries only to executables" OFF) option( USE_SUPERBUILD "use ccache" ON) +set(NG_COMPILE_FLAGS "" CACHE STRING "Additional compile flags") + set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_modules") if(APPLE) diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index e28c034b..37709768 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -145,6 +145,7 @@ set_vars( NETGEN_CMAKE_ARGS CHECK_RANGE BUILD_STUB_FILES BUILD_FOR_CONDA + NG_COMPILE_FLAGS ) # propagate all variables set on the command line using cmake -DFOO=BAR diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt index a2873ed9..8329a195 100644 --- a/libsrc/core/CMakeLists.txt +++ b/libsrc/core/CMakeLists.txt @@ -14,6 +14,8 @@ add_library(ngcore SHARED version.cpp ) +target_compile_options(ngcore PUBLIC "${NG_COMPILE_FLAGS}") + # Pybind11 2.3 Issue https://github.com/pybind/pybind11/issues/1604 if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") target_compile_options(ngcore PUBLIC -fsized-deallocation -faligned-allocation)