kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #20165
[PATCH] Move OpenMP out of gcc/clang conditional
Hi,
CMake's test for OpenMP is generic enough to work anywhere, so there is no
good reason to make it conditional on gcc/clang.
This moves the OpenMP handling to the CMakeLists.txt toplevel.
Simon
---
CMakeLists.txt | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3911119..5b3796c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,20 +192,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG" )
- find_package( OpenMP QUIET )
-
- if( OPENMP_FOUND )
- set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
- add_definitions( -DUSE_OPENMP )
-
- # MinGW does not include the OpenMP link library and FindOpenMP.cmake does not
- # set it either. Not sure this is the most elegant solution but it works.
- if( MINGW )
- set( OPENMP_LIBRARIES gomp )
- endif()
- endif()
-
if( MINGW )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
@@ -444,6 +430,25 @@ include( ExternalProject )
#================================================
include( CheckFindPackageResult )
+#######################
+# Find OpenMP support #
+#######################
+
+find_package( OpenMP QUIET )
+check_find_package_result( OPENMP_FOUND "OpenMP" )
+
+if( OPENMP_FOUND )
+ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
+ add_definitions( -DUSE_OPENMP )
+
+ # MinGW does not include the OpenMP link library and FindOpenMP.cmake does not
+ # set it either. Not sure this is the most elegant solution but it works.
+ if( MINGW )
+ set( OPENMP_LIBRARIES gomp )
+ endif()
+endif()
+
##########################
# Find wxWidgets library #
##########################