File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ option(TBB_CPF "Enable preview features of the library" OFF)
116116option (TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF )
117117option (TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH "Disable HWLOC automatic search by pkg-config tool" ${CMAKE_CROSSCOMPILING} )
118118option (TBB_ENABLE_IPO "Enable Interprocedural Optimization (IPO) during the compilation" ON )
119+ option (TBB_CONTROL_FLOW_GUARD "Enable Control Flow Guard (CFG) during the compilation" OFF )
119120option (TBB_FUZZ_TESTING "Enable fuzz testing" OFF )
120121option (TBB_INSTALL "Enable installation" ON )
121122option (TBB_FILE_TRIM "Enable __FILE__ trim" ON )
@@ -247,6 +248,10 @@ if (TBB_FILE_TRIM)
247248 file (TO_NATIVE_PATH ${TBB_RELATIVE_BIN_PATH} NATIVE_TBB_RELATIVE_BIN_PATH)
248249endif ()
249250
251+ if (TBB_CONTROL_FLOW_GUARD)
252+ message (STATUS "Control Flow Guard (CFG) enabled" )
253+ endif ()
254+
250255set (TBB_COMPILER_SETTINGS_FILE ${CMAKE_CURRENT_SOURCE_DIR} /cmake/compilers/${CMAKE_CXX_COMPILER_ID} .cmake)
251256if (EXISTS ${TBB_COMPILER_SETTINGS_FILE} )
252257 include (${TBB_COMPILER_SETTINGS_FILE} )
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ TBB_INSTALL_VARS:BOOL - Enable auto-generated vars installation(packages generat
2020TBB_VALGRIND_MEMCHECK:BOOL - Enable scan for memory leaks using Valgrind (OFF by default)
2121TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH - Disable HWLOC automatic search by pkg-config tool (OFF by default)
2222TBB_ENABLE_IPO - Enable Interprocedural Optimization (IPO) during the compilation (ON by default)
23+ TBB_CONTROL_FLOW_GUARD:BOOL - Enable Control Flow Guard (CFG) during the compilation (OFF by default)
2324TBB_BUILD_APPLE_FRAMEWORKS - Enable the Apple* frameworks instead of dylibs, only available on the Apple platform. (OFF by default)
2425TBB_FILE_TRIM - Enable __FILE__ trim, replace a build-time full path with a relative path in the debug info and macro __FILE__; use it to make
2526 reproducible location-independent builds (ON by default)
Original file line number Diff line number Diff line change @@ -83,6 +83,11 @@ if (TBB_FILE_TRIM)
8383 "$<$<COMPILE_LANGUAGE:CXX>:/d1trimfile:${CMAKE_SOURCE_DIR} />" )
8484endif ()
8585
86+ if (TBB_CONTROL_FLOW_GUARD)
87+ set (TBB_LIB_COMPILE_FLAGS ${TBB_LIB_COMPILE_FLAGS} /guard:cf)
88+ set (TBB_LIB_LINK_FLAGS ${TBB_LIB_LINK_FLAGS} /guard:cf)
89+ endif ()
90+
8691if (CMAKE_CXX_COMPILER_ID MATCHES "(Clang|IntelLLVM)" )
8792 if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86|AMD64|i.86)" )
8893 set (TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm -mwaitpkg)
You can’t perform that action at this time.
0 commit comments