Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix install #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions build/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ if(ENABLE_OPENMP)
endif()

# Define variables to use for organizing the installation.
include(GNUInstallDirs)
include(GNUInstallDirs)

if(WIN32)
set(COLPACK_INSTALL_CMAKEDIR ColPack_libs)
set(COLPACK_INSTALL_EXAMPLESBINDIR ColPack_examples)
else()
set(COLPACK_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/ColPack_libs)
set(COLPACK_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/ColPack")
# To follow the UNIX Filsystem Hierarchy Standard, we should install
# examples somewhere else:
set(COLPACK_INSTALL_EXAMPLESBINDIR ${CMAKE_INSTALL_LIBDIR}/ColPack_examples)
Expand Down Expand Up @@ -132,7 +132,7 @@ target_include_directories(ColPack_static PRIVATE
# "$<BUILD_INTERFACE:${COLPACK_SOURCE_INCLUDE_DIRS}>")
# For clients of an installation of ColPack.
target_include_directories(ColPack_static INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ColPack>)

if(ENABLE_OPENMP)
set_target_properties(ColPack_static PROPERTIES COMPILE_FLAGS
Expand All @@ -142,9 +142,7 @@ endif()
# "EXPORT" helps with creating a ColPackConfig.cmake file to place in the
# installation, to help downstream projects use ColPack.
install(TARGETS ColPack_static EXPORT ColPackTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/archive
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/library
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/runtime)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})


# Shared library.
Expand All @@ -162,20 +160,17 @@ target_include_directories(ColPack_shared PRIVATE
# "$<BUILD_INTERFACE:${COLPACK_SOURCE_INCLUDE_DIRS}>")
# For clients of an installation of ColPack.
target_include_directories(ColPack_shared INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ColPack>)

if(ENABLE_OPENMP)
set_target_properties(ColPack_shared PROPERTIES COMPILE_FLAGS
${OpenMP_CXX_FLAGS})
target_link_libraries(ColPack_shared PRIVATE ${OpenMP_CXX_FLAGS})
endif()

install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ColPack_headers)
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ColPack)

install(TARGETS ColPack_shared EXPORT ColPackTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/shared_archive
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/shared_library
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/shared_runtime)
install(TARGETS ColPack_shared EXPORT ColPackTargets)



Expand Down Expand Up @@ -254,23 +249,30 @@ endforeach()

# Create files that define the ColPack targets to import into other projects.
# https://cmake.org/cmake/help/v3.1/manual/cmake-packages.7.html
install(EXPORT ColPackTargets DESTINATION ${COLPACK_INSTALL_CMAKEDIR})

install(EXPORT ColPackTargets
DESTINATION ${COLPACK_INSTALL_CMAKEDIR}
NAMESPACE "ColPack::")

# CMake Config file., and version file, which CMake will look for when
# downstream projects use find_package(ColPack).
include(CMakePackageConfigHelpers)
# The ConfigVersion file determines if an installed copy of ColPack is
# compatible with a user's requested version for ColPack.

write_basic_package_version_file(
"${CMAKE_BINARY_DIR}/ColPackConfigVersion.cmake"
VERSION ${COLPACK_VERSION}
COMPATIBILITY AnyNewerVersion)

configure_package_config_file(ColPackConfig.cmake.in
"${CMAKE_BINARY_DIR}/ColPackConfigToInstall.cmake"
INSTALL_DESTINATION ${COLPACK_INSTALL_CMAKEDIR}
PATH_VARS CMAKE_INSTALL_PREFIX)

install(FILES "${CMAKE_BINARY_DIR}/ColPackConfigToInstall.cmake"
DESTINATION ${COLPACK_INSTALL_CMAKEDIR}
RENAME ColPackConfig.cmake)

install(FILES "${CMAKE_BINARY_DIR}/ColPackConfigVersion.cmake"
DESTINATION ${COLPACK_INSTALL_CMAKEDIR})