diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 1d87bc1b8..4076d9fab 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -519,7 +519,11 @@ 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)) - set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS) + if(MSVC) + set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS) + else() + add_definitions(-DCVAPI_EXPORTS) + endif() endif() if(MSVC)