cmake(opt): force separate targets for dispatched code
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Wed, 5 Oct 2022 18:51:39 +0000 (21:51 +0300)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Wed, 5 Oct 2022 18:54:46 +0000 (21:54 +0300)
- PCH may not pass compilation flags properly

cmake/OpenCVCompilerOptimizations.cmake

index 1e0e812afcf9258266463e3c837e3972e8700969..598389bd3497342af0480ea58e119088a6567c60 100644 (file)
@@ -680,7 +680,7 @@ macro(ocv_compiler_optimization_process_sources SOURCES_VAR_NAME LIBS_VAR_NAME T
           if(fname_LOWER MATCHES "\\.${OPT_LOWER}\\.cpp$")
 #message("${fname} BASELINE-${OPT}")
             set(__opt_found 1)
-            list(APPEND __result "${fname}")
+            list(APPEND __result_${OPT} "${fname}")
             break()
           endif()
         endforeach()
@@ -714,7 +714,7 @@ macro(ocv_compiler_optimization_process_sources SOURCES_VAR_NAME LIBS_VAR_NAME T
     endif()
   endforeach()
 
-  foreach(OPT ${CPU_DISPATCH_FINAL})
+  foreach(OPT ${CPU_BASELINE_FINAL} ${CPU_DISPATCH_FINAL})
     if(__result_${OPT})
 #message("${OPT}: ${__result_${OPT}}")
       if(CMAKE_GENERATOR MATCHES "^Visual"