diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-01-22 01:33:49 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-01-22 18:05:36 +0000 |
commit | 0a6b4258ab0e773b7b2b06db1317faf556931481 (patch) | |
tree | 6fe1b40300d74af003ddcddcbab18ef054496659 | |
parent | 896a543e72fd3ab044e64d1140a37c7f4876fc71 (diff) |
[openmp][cmake] Use `GNUInstallDirs` to support custom installation dirs
I am breaking apart D99484 so the cause of build failures is easier to
understand.
Differential Revision: https://reviews.llvm.org/D117945
-rw-r--r-- | openmp/CMakeLists.txt | 5 | ||||
-rw-r--r-- | openmp/libompd/src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | openmp/runtime/cmake/LibompCheckLinkerFlag.cmake | 2 | ||||
-rw-r--r-- | openmp/runtime/src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | openmp/tools/multiplex/CMakeLists.txt | 2 |
5 files changed, 12 insertions, 5 deletions
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index 7f11a05f5622..4530281aff26 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -7,7 +7,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") set(OPENMP_STANDALONE_BUILD TRUE) project(openmp C CXX) +endif() + +# Must go below project(..) +include(GNUInstallDirs) +if (OPENMP_STANDALONE_BUILD) # CMAKE_BUILD_TYPE was not set, default to Release. if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) diff --git a/openmp/libompd/src/CMakeLists.txt b/openmp/libompd/src/CMakeLists.txt index 9c203bdd6b4f..25a850ed457d 100644 --- a/openmp/libompd/src/CMakeLists.txt +++ b/openmp/libompd/src/CMakeLists.txt @@ -47,4 +47,4 @@ include_directories ( INSTALL( TARGETS ompd LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR} ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR} - RUNTIME DESTINATION bin ) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ) diff --git a/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake b/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake index fb284599ca38..4c30514af88e 100644 --- a/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake +++ b/openmp/runtime/cmake/LibompCheckLinkerFlag.cmake @@ -8,6 +8,8 @@ #//===----------------------------------------------------------------------===// # +include(GNUInstallDirs) + # Checking a linker flag to build a shared library # There is no real trivial way to do this in CMake, so we implement it here # this will have ${boolean} = TRUE if the flag succeeds, otherwise FALSE. diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index e4f4e6e1e73f..27e748c4d6dc 100644 --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -346,19 +346,19 @@ add_dependencies(libomp-micro-tests libomp-test-deps) # We want to install libomp in DESTDIR/CMAKE_INSTALL_PREFIX/lib # We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include if(${OPENMP_STANDALONE_BUILD}) - set(LIBOMP_HEADERS_INSTALL_PATH include) + 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 bin) + install(TARGETS omp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}") # Create aliases (regular copies) of the library for backwards compatibility set(LIBOMP_ALIASES "libiomp5md") foreach(alias IN LISTS LIBOMP_ALIASES) install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\" - \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/bin\")") + \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_BINDIR}\")") install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\" \"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR}\")") endforeach() diff --git a/openmp/tools/multiplex/CMakeLists.txt b/openmp/tools/multiplex/CMakeLists.txt index 64317c112176..8b50e95899cc 100644 --- a/openmp/tools/multiplex/CMakeLists.txt +++ b/openmp/tools/multiplex/CMakeLists.txt @@ -4,7 +4,7 @@ if(LIBOMP_OMPT_SUPPORT) add_library(ompt-multiplex INTERFACE) target_include_directories(ompt-multiplex INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) - install(FILES ompt-multiplex.h DESTINATION include) + install(FILES ompt-multiplex.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") add_subdirectory(tests) endif() |