[PATCH] [OpenMP] Make default OpenMP library (the one selected with just -fopenmp) configurable in the CMake build. There shouldn't be any change in default behavior.

Richard Smith richard at metafoo.co.uk
Wed May 20 13:12:28 PDT 2015


================
Comment at: lib/Driver/Tools.cpp:6294-6309
@@ -6290,14 +6293,18 @@
   } else if (Args.hasArg(options::OPT_fopenmp)) {
+#if defined(OPENMP_DEFAULT_LIB)
+    UsedOpenMPLib = OpenMPStringToVersion(OPENMP_DEFAULT_LIB);
+#else
     UsedOpenMPLib = LibIOMP5;
+#endif
   }
   switch (UsedOpenMPLib) {
   case LibGOMP:
     CmdArgs.push_back("-lgomp");
     break;
   case LibIOMP5:
     CmdArgs.push_back("-liomp5");
     break;
   case LibUnknown:
     break;
   }
 
----------------
It seems bad to silently not link against any OpenMP library if the value for `OPENMP_DEFAULT_LIB` is unknown. Maybe either `OPENMP_DEFAULT_LIB` should be a lib name that we blindly add to the link line (`"-l" #OPENMP_DEFAULT_LIB`), or we should check the value is valid in `CMakeLists.txt`.

================
Comment at: lib/Driver/Tools.cpp:6295
@@ +6294,3 @@
+#if defined(OPENMP_DEFAULT_LIB)
+    UsedOpenMPLib = OpenMPStringToVersion(OPENMP_DEFAULT_LIB);
+#else
----------------
Hm, are you expecting the `-D` value to already include the double-quotes? If not, this looks wrong. And if so, you should not be adding a trailing space in CMakeLists.txt.

http://reviews.llvm.org/D9878

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list