[Openmp-commits] [PATCH] D117945: [openmp][cmake] Use `GNUInstallDirs` to support custom installation dirs
John Ericson via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Fri Jan 21 23:00:28 PST 2022
Ericson2314 created this revision.
Ericson2314 added reviewers: phosek, compnerd, beanz.
Herald added subscribers: guansong, yaxunl, mgorny.
Ericson2314 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.
I am breaking apart D99484 <https://reviews.llvm.org/D99484> so the cause of build failures is easier to
understand.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117945
Files:
openmp/CMakeLists.txt
openmp/libompd/src/CMakeLists.txt
openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
openmp/runtime/src/CMakeLists.txt
openmp/tools/multiplex/CMakeLists.txt
Index: openmp/tools/multiplex/CMakeLists.txt
===================================================================
--- openmp/tools/multiplex/CMakeLists.txt
+++ 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 include)
+ install(FILES ompt-multiplex.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
add_subdirectory(tests)
endif()
Index: openmp/runtime/src/CMakeLists.txt
===================================================================
--- openmp/runtime/src/CMakeLists.txt
+++ openmp/runtime/src/CMakeLists.txt
@@ -346,19 +346,19 @@
# 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()
Index: openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
===================================================================
--- openmp/runtime/cmake/LibompCheckLinkerFlag.cmake
+++ 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.
Index: openmp/libompd/src/CMakeLists.txt
===================================================================
--- openmp/libompd/src/CMakeLists.txt
+++ openmp/libompd/src/CMakeLists.txt
@@ -47,4 +47,4 @@
INSTALL( TARGETS ompd
LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR}
- RUNTIME DESTINATION bin )
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" )
Index: openmp/CMakeLists.txt
===================================================================
--- openmp/CMakeLists.txt
+++ openmp/CMakeLists.txt
@@ -7,7 +7,12 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117945.402179.patch
Type: text/x-patch
Size: 3628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220122/1018095b/attachment.bin>
More information about the Openmp-commits
mailing list