diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -75,6 +75,14 @@ ${ENABLE_LIBOMPTARGET}) option(OPENMP_ENABLE_LIBOMP_PROFILING "Enable time profiling for libomp." OFF) +# Header install location +if(${OPENMP_STANDALONE_BUILD}) + set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}") +else() + string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION}) + set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include") +endif() + # Build host runtime library, after LIBOMPTARGET variables are set since they are needed # to enable time profiling support in the OpenMP runtime. add_subdirectory(runtime) diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -355,12 +355,6 @@ # Install rules # We want to install libomp in ${DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR} # We want to install headers in ${DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR} -if(${OPENMP_STANDALONE_BUILD}) - set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}") -else() - string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION}) - set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include") -endif() if(WIN32) install(TARGETS omp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") diff --git a/openmp/tools/multiplex/CMakeLists.txt b/openmp/tools/multiplex/CMakeLists.txt --- a/openmp/tools/multiplex/CMakeLists.txt +++ b/openmp/tools/multiplex/CMakeLists.txt @@ -4,7 +4,7 @@ add_library(ompt-multiplex INTERFACE) target_include_directories(ompt-multiplex INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) - install(FILES ompt-multiplex.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + install(FILES ompt-multiplex.h DESTINATION "${LIBOMP_HEADERS_INSTALL_PATH}") add_subdirectory(tests) endif()