[mlpack-git] master: Remove unused HAS_OPENMP CMake variable (not the compiler definition). (77d098c)

gitdub at mlpack.org gitdub at mlpack.org
Fri Jul 8 14:40:54 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/425324bf7fb7c86c85d10a909d8a59d4f69b7164...44c7c3578f5fddb1dc15b42e8c52861ba987a37e

>---------------------------------------------------------------

commit 77d098c4774107e1b71e214dcc56abf99c425abb
Author: Ryan Curtin <ryan at ratml.org>
Date:   Fri Jul 8 14:40:54 2016 -0400

    Remove unused HAS_OPENMP CMake variable (not the compiler definition).
    
    Also remove -DHAS_OPENMP when OpenMP is not found.


>---------------------------------------------------------------

77d098c4774107e1b71e214dcc56abf99c425abb
 CMakeLists.txt | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ca0ace..80a92a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -232,19 +232,22 @@ endif ()
 add_definitions(-DBOOST_TEST_DYN_LINK)
 
 # Detect OpenMP support in a compiler. If the compiler supports OpenMP, flags
-# to compile with OpenMP are returned and added and the HAS_OPENMP is set to 1.
+# to compile with OpenMP are returned and added and the HAS_OPENMP definition is
+# added for compilation.
+#
 # This way we can skip calls to functions defined in omp.h with code like:
-# if (HAS_OPENMP == 1) { openMP code here }
-# If OpenMP is found, define HAS_OPENMP to be 1. Otherwise define it to be 0.
+# #ifdef HAS_OPENMP
+# {
+#   ... openMP code here ...
+# }
+# #endif
 find_package(OpenMP)
 if (OPENMP_FOUND)
   add_definitions(-DHAS_OPENMP)
-  set(HAS_OPENMP 1)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
 else ()
-  add_definitions(-DHAS_OPENMP)
-  set(HAS_OPENMP 0)
+  # Disable warnings for all the unknown OpenMP pragmas.
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
 endif ()
 




More information about the mlpack-git mailing list