22# CMakeLists.txt - CMake configuration file for OpenMP Library on Darwin
33#
44# Created: Mar 17, 2021
5- # Updated: May 19, 2021
5+ # Updated: Aug 29, 2025
66#
77# Author: Michael E. Tryby
88# US EPA ORD/CESER
1414# instead.
1515#
1616# All sources were obtained directly from the LLVM releases on github
17- # See license-llvm-openmp.txt for the corresponding license and
18- # https://openmp.llvm.org/ for details on the OpenMP run-time.
17+ # See license-llvm-openmp.txt for the corresponding license and
18+ # https://openmp.llvm.org/ for details on the OpenMP run-time.
1919
2020################################################################################
2121##################### CMAKELISTS FOR OPENMP LIBRARY ######################
2222################################################################################
2323
24- include (FetchContent)
2524
25+ # Append local dir to module search path
26+ list (
27+ APPEND CMAKE_MODULE_PATH
28+ ${CMAKE_BINARY_DIR} /_deps/llvm_cmake-src/Modules
29+ )
30+
31+ include (
32+ FetchContent
33+ )
34+
35+
36+ # v17.0.1 (v17.0.0 was yanked)
37+ FetchContent_Declare(
38+ llvm_cmake
39+ URL
40+ https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/cmake-17.0.1.src.tar.xz
41+ URL_HASH
42+ SHA256=46e745d9bdcd2e18719a47b080e65fd476e1f6c4bbaa5947e4dee057458b78bc
43+ )
2644
27- FetchContent_Declare(OpenMP
45+ FetchContent_Declare(
46+ OpenMP
2847 URL
29- https://github.com/llvm/llvm-project/releases/download/llvmorg-12 .0.1/openmp-12 .0.1.src.tar.xz
48+ https://github.com/llvm/llvm-project/releases/download/llvmorg-17 .0.1/openmp-17 .0.1.src.tar.xz
3049 URL_HASH
31- SHA256=60fe79440eaa9ebf583a6ea7f81501310388c02754dbe7dc210776014d06b091
50+ SHA256=d4a25c04d1bc035990a85f172bfe29a38f21ff87448f7fbae165fa780cb95717
51+ OVERRIDE_FIND_PACKAGE
3252)
3353
34- set (OPENMP_STANDALONE_BUILD TRUE )
35- set (LIBOMP_INSTALL_ALIASES OFF )
54+ set (
55+ OPENMP_STANDALONE_BUILD
56+ TRUE
57+ )
58+ set (
59+ LIBOMP_INSTALL_ALIASES
60+ OFF
61+ )
3662
37- FetchContent_MakeAvailable(OpenMP)
38- set (OpenMP_AVAILABLE TRUE )
63+ FetchContent_MakeAvailable(
64+ llvm_cmake
65+ OpenMP
66+ )
3967
68+ target_compile_options (
69+ omp
70+ INTERFACE
71+ -Xclang
72+ -fopenmp
73+ )
4074
41- target_link_directories (omp
75+ target_link_directories (
76+ omp
4277 PUBLIC
4378 $<BUILD_INTERFACE:${CMAKE_BINARY_DIR} /_deps/openmp-build /runtime/src>
44- $<INSTALL_INTERFACE:${LIBRARY_DIST} >
79+ $<INSTALL_INTERFACE:/ include >
4580)
4681
47- install (TARGETS omp
48- LIBRARY
49- DESTINATION
50- " ${LIBRARY_DIST} "
82+ add_library (
83+ OpenMP::OpenMP_C
84+ ALIAS
85+ omp
5186)
52-
53- if (CMAKE_C_COMPILER_ID MATCHES "Clang\$ " )
54- set (OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I${CMAKE_BINARY_DIR} /_deps/openmp-build/runtime/src" )
55- set (OpenMP_C_LIB_NAMES "omp" )
56- set (OpenMP_omp_LIBRARY "${CMAKE_BINARY_DIR} /_deps/openmp-build/runtime/src/libomp.dylib" )
57- endif ()
58-
59- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang\$ " )
60- set (OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I${CMAKE_BINARY_DIR} /_deps/openmp-build/runtime/src" )
61- set (OpenMP_CXX_LIB_NAMES "omp" )
62- set (OpenMP_omp_LIBRARY "${CMAKE_BINARY_DIR} /_deps/openmp-build/runtime/src/libomp.dylib" )
63- endif ()
0 commit comments