Fixing compiler flags checks.

pull/2/head
Andrey Kamaev 13 years ago
parent c5aba337e9
commit 37212f5e00
  1. 4
      CMakeLists.txt
  2. 7
      cmake/OpenCVCompilerOptions.cmake

@ -287,13 +287,13 @@ endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# OpenCV compiler and linker options # OpenCV compiler and linker options
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
include(cmake/OpenCVCompilerOptions.cmake REQUIRED)
# In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release: # In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release:
if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja" AND "${CMAKE_BUILD_TYPE}" STREQUAL "") if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja" AND "${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
endif() endif()
include(cmake/OpenCVCompilerOptions.cmake REQUIRED)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Use statically or dynamically linked CRT? # Use statically or dynamically linked CRT?

@ -33,12 +33,15 @@ set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "")
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "") set(OPENCV_EXTRA_EXE_LINKER_FLAGS_DEBUG "")
macro(add_extra_compiler_option option) macro(add_extra_compiler_option option)
ocv_check_flag_support(CXX "${option}" _varname ${ARGN}) if(CMAKE_BUILD_TYPE)
set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
endif()
ocv_check_flag_support(CXX "${option}" _varname "${OPENCV_EXTRA_CXX_FLAGS} ${ARGN}")
if(${_varname}) if(${_varname})
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} ${option}") set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} ${option}")
endif() endif()
ocv_check_flag_support(C "${option}" _varname ${ARGN}) ocv_check_flag_support(C "${option}" _varname "${OPENCV_EXTRA_C_FLAGS} ${ARGN}")
if(${_varname}) if(${_varname})
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} ${option}") set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} ${option}")
endif() endif()

Loading…
Cancel
Save