Commit 7f819008 authored by Alexander Smorkalov's avatar Alexander Smorkalov Committed by OpenCV Buildbot

Merge pull request #1500 from alalek:fix_add_definitions

parents 9f191264 b4a534a2
......@@ -519,11 +519,7 @@ macro(ocv_create_module)
if((NOT DEFINED OPENCV_MODULE_TYPE AND BUILD_SHARED_LIBS)
OR (DEFINED OPENCV_MODULE_TYPE AND OPENCV_MODULE_TYPE STREQUAL SHARED))
if(MSVC)
set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
else()
add_definitions(-DCVAPI_EXPORTS)
endif()
set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
endif()
if(MSVC)
......
......@@ -25,11 +25,13 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
SET(_PCH_include_prefix "-I")
SET(_PCH_isystem_prefix "-isystem")
SET(_PCH_define_prefix "-D")
ELSEIF(CMAKE_GENERATOR MATCHES "^Visual.*$")
SET(PCHSupport_FOUND TRUE)
SET(_PCH_include_prefix "/I")
SET(_PCH_isystem_prefix "/I")
SET(_PCH_define_prefix "/D")
ELSE()
SET(PCHSupport_FOUND FALSE)
ENDIF()
......@@ -237,6 +239,14 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
_PCH_GET_COMPILE_FLAGS(_compile_FLAGS)
get_target_property(type ${_targetName} TYPE)
if(type STREQUAL "SHARED_LIBRARY")
get_target_property(__DEFINES ${_targetName} DEFINE_SYMBOL)
if(NOT __DEFINES MATCHES __DEFINES-NOTFOUND)
list(APPEND _compile_FLAGS "${_PCH_define_prefix}${__DEFINES}")
endif()
endif()
#MESSAGE("_compile_FLAGS: ${_compile_FLAGS}")
#message("COMMAND ${CMAKE_CXX_COMPILER} ${_compile_FLAGS} -x c++-header -o ${_output} ${_input}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment