提交 69df0eee 编写于 作者: A Alexander Alekhin

cmake: fix try_compile() with --coverage flags

上级 f70cc29e
......@@ -95,6 +95,10 @@ if(POLICY CMP0051)
cmake_policy(SET CMP0051 NEW)
endif()
if(POLICY CMP0056)
cmake_policy(SET CMP0056 NEW)
endif()
include(cmake/OpenCVUtils.cmake)
# must go before the project command
......
......@@ -192,6 +192,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
if(ENABLE_COVERAGE)
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} --coverage")
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
if(ENABLE_INSTRUMENTATION)
......
......@@ -260,6 +260,7 @@ MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
TRY_COMPILE(${RESULT}
"${CMAKE_BINARY_DIR}"
"${_fname}"
CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}" # CMP0056 do this on new CMake
COMPILE_DEFINITIONS "${FLAG}"
OUTPUT_VARIABLE OUTPUT)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册