I'm trying to build a project with OpenMp on Mojave using cmake - following this method. I've tried all of the solutions presented in similar posts, but with no success. I am aware example is for High Sierra, so I might be presuming too much in following it.
My cmakelists.txt:
cmake_minimum_required(VERSION 3.9)
include_directories(${ProjectName_SOURCE_DIR}/src)
link_directories(${ProjectName_BINARY_DIR}/src)
set(CMAKE_CXX_STANDARD 14)
set (lib_SOURCES
../src/example.h
../src/example.cpp
external.cpp)
add_library(foo MODULE ${lib_SOURCES})
find_package(OpenMP REQUIRED)
target_link_libraries(foo PRIVATE OpenMP::OpenMP_CXX)
CMake error returned is:
Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
As per this suggestion, if I add ctdegroot's fix right above the find_package line, this seems to 'help', in the sense that the cmake then reload returns:
Cannot get compiler information:
Compiler exited with error code 1: /Library/Developer/CommandLineTools/usr/bin/c++ -xc++ -Dfoo_EXPORTS -I/Users/MyUser/Documents/SomeDirectory/Project/src -I/usr/local/include -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -fPIC -fopenmp=libomp -Wno-unused-command-line-argument -std=gnu++14 -fpch-preprocess -v -dD -E
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
clang: error: unsupported argument 'libomp' to option 'fopenmp='
A build in this case simply returns:
clang: error: unsupported argument 'libomp' to option 'fopenmp='
I intellectually understand that the OSX clang does not properly support OpenMP, but I'm unsure how to resolve the problem. Thanks in advance.