Skip to content

Commit 35ded9a

Browse files
committed
fix(cmake/modules): added compiler flags for gtest
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
1 parent 8a63a7b commit 35ded9a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

cmake/modules/falcosecurity-libs.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ else()
9393
message(STATUS "No strlcpy found, will use local definition")
9494
endif()
9595

96+
include(CheckCXXCompilerFlag)
97+
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
98+
if(CREATE_TEST_TARGETS AND NOT WIN32 AND COMPILER_SUPPORTS_CXX14)
99+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
100+
include(gtest)
101+
elseif(CREATE_TEST_TARGETS AND NOT COMPILER_SUPPORTS_CXX14)
102+
message(FATAL_ERROR "Your compiler doesn't support c++14: cannot include gtest and create test targets.")
103+
endif()
104+
96105
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
97106
include(driver)
98107
endif()

0 commit comments

Comments
 (0)