我正在尝试在Windows上运行此cmake文件
cmake_minimum_required(VERSION 3.8)
set(CMAKE_C_COMPILER "C:/Program Files/LLVM/bin/clang")
set(CMAKE_CXX_COMPILER "C:/Program Files/LLVM/bin/clang++")
set(OPENMP_LIBRARIES "C:/Program Files/LLVM/lib")
set(OPENMP_INCLUDES "C:/Program Files/LLVM/include")
set(OpenMP_C "${CMAKE_C_COMPILER}")
set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
message("!!!!!!!!!!!!!!!! " ${OpenMP_C_FLAGS} )
find_package(OpenMP REQUIRED)
使用以下命令行参数:
cmake -G“ Visual Studio 15 2017” -T LLVM ..
奇怪的是,即使根据输出定义了OpenMP_C_FLAGS,我仍然得到了休闲错误:
-- The C compiler identification is Clang 9.0.0
-- The CXX compiler identification is Clang 9.0.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
!!!!!!!!!!!!!!!! -fopenmp=libomp -Wno-unused-command-line-argument
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.13/Modules/FindOpenMP.cmake:473 (find_package_handle_standard_args)
CMakeLists.txt:25 (find_package)
-- Configuring incomplete, errors occurred!
如果我运行不带-T LLVM标志的cmake,则cmake FindOpenMP.cmake可以正常运行(使用Windows编译器)。 clang在Windows上不支持openmp吗?