From 7726821f0bf301919243822a6948fe7c0f8e7590 Mon Sep 17 00:00:00 2001 From: Thomas Hahn Date: Tue, 22 Oct 2024 09:24:07 -0400 Subject: [PATCH] [cmake] Use GNUInstallDirs more consistently --- c2py_flags.py.in | 8 ++++---- share/c2py.modulefile.in | 9 ++++----- share/c2pyvars.sh.in | 9 ++++----- share/cmake/CMakeLists.txt | 2 +- share/cmake/c2py-config.cmake.in | 4 ++-- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/c2py_flags.py.in b/c2py_flags.py.in index 375e0d3..70b3790 100755 --- a/c2py_flags.py.in +++ b/c2py_flags.py.in @@ -1,8 +1,8 @@ #!@Python_EXECUTABLE@ -cxxflags = "-I@CMAKE_INSTALL_PREFIX@/include " -ldflags = " -L@CMAKE_INSTALL_PREFIX@/lib -lc2py " +cxxflags = "-I@CMAKE_INSTALL_FULL_INCLUDEDIR@ " +ldflags = " -L@CMAKE_INSTALL_FULL_LIBDIR@ -lc2py " -if __name__ == "__main__" : +if __name__ == "__main__" : print("%s %s -fPIC %s "%(cxxflags, ldflags, "@c2py_all_python_flags@")) - + diff --git a/share/c2py.modulefile.in b/share/c2py.modulefile.in index f03fe63..7848a13 100644 --- a/share/c2py.modulefile.in +++ b/share/c2py.modulefile.in @@ -27,8 +27,7 @@ setenv C2PY_ROOT $root setenv C2PY_VERSION $version setenv C2PY_GIT_HASH $git_hash -prepend-path PATH $root/bin -prepend-path CPLUS_INCLUDE_PATH $root/include -prepend-path LIBRARY_PATH $root/lib -prepend-path PYTHONPATH $root/@PYTHON_LIB_DEST_ROOT@ -prepend-path CMAKE_PREFIX_PATH $root/lib/cmake/c2py +prepend-path PATH @CMAKE_INSTALL_FULL_BINDIR@ +prepend-path CPLUS_INCLUDE_PATH @CMAKE_INSTALL_FULL_INCLUDEDIR@ +prepend-path LIBRARY_PATH @CMAKE_INSTALL_FULL_LIBDIR@ +prepend-path CMAKE_PREFIX_PATH @CMAKE_INSTALL_FULL_LIBDIR@/cmake/c2py diff --git a/share/c2pyvars.sh.in b/share/c2pyvars.sh.in index ee2a110..db241e4 100644 --- a/share/c2pyvars.sh.in +++ b/share/c2pyvars.sh.in @@ -1,7 +1,6 @@ # Source this in your environment. -export CPLUS_INCLUDE_PATH=@CMAKE_INSTALL_PREFIX@/include:$CPLUS_INCLUDE_PATH -export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH -export LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:$LIBRARY_PATH -export PYTHONPATH=@CMAKE_INSTALL_PREFIX@/@PYTHON_LIB_DEST_ROOT@:$PYTHONPATH -export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@/lib/cmake/C2Py:$CMAKE_PREFIX_PATH +export CPLUS_INCLUDE_PATH=@CMAKE_INSTALL_FULL_INCLUDEDIR@:$CPLUS_INCLUDE_PATH +export PATH=@CMAKE_INSTALL_FULL_BINDIR@:$PATH +export LIBRARY_PATH=@CMAKE_INSTALL_FULL_LIBDIR@:$LIBRARY_PATH +export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_FULL_LIBDIR@/cmake/c2py:$CMAKE_PREFIX_PATH diff --git a/share/cmake/CMakeLists.txt b/share/cmake/CMakeLists.txt index 46e85eb..fe62ca1 100644 --- a/share/cmake/CMakeLists.txt +++ b/share/cmake/CMakeLists.txt @@ -4,7 +4,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/c2py-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/c2py-config-version.cmake - DESTINATION lib/cmake/c2py + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/c2py ) install(EXPORT c2py-targets NAMESPACE c2py:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/c2py) diff --git a/share/cmake/c2py-config.cmake.in b/share/cmake/c2py-config.cmake.in index e4e9874..b176d20 100644 --- a/share/cmake/c2py-config.cmake.in +++ b/share/cmake/c2py-config.cmake.in @@ -14,12 +14,12 @@ set(c2py_ROOT @CMAKE_INSTALL_PREFIX@ CACHE PATH "Root of c2py") # Mac specific if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(CMAKE_INSTALL_NAME_DIR "@CMAKE_INSTALL_PREFIX@/lib") + set(CMAKE_INSTALL_NAME_DIR "@CMAKE_INSTALL_FULL_LIBDIR@") set(CMAKE_MACOSX_RPATH 1) # new for cmake 3.x endif() # include the exported targets of this project -include(@CMAKE_INSTALL_PREFIX@/lib/cmake/c2py/c2py-targets.cmake) +include(@CMAKE_INSTALL_FULL_LIBDIR@/cmake/c2py/c2py-targets.cmake) #SET(C2PY_C2PY_MODULE_EXTENSION "wrap.cxx")