Skip to content

Commit

Permalink
fix: CMake install should be arch independent
Browse files Browse the repository at this point in the history
This library is a header only library and the CMake package should not
depend on the 32/64bit of the original compiler.
  • Loading branch information
pleroux0 authored and martinmoene committed Mar 18, 2019
1 parent 72b87a8 commit 916f0e1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Expand Up @@ -94,11 +94,8 @@ configure_package_config_file(
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${package_folder}"
)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${package_config_version}"
VERSION ${package_version}
COMPATIBILITY SameMajorVersion
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/span-lite-config-version.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${package_config_version}" @ONLY)

# Installation:

Expand Down
25 changes: 25 additions & 0 deletions cmake/span-lite-config-version.cmake.in
@@ -0,0 +1,25 @@
# Adapted from write_basic_package_version_file(... COMPATIBILITY SameMajorVersion) output
# ARCH_INDEPENDENT is only present in cmake 3.14 and onwards

set(PACKAGE_VERSION "@package_version@")

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

if("@package_version@" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_MAJOR "@package_version@")
endif()

if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()

if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

0 comments on commit 916f0e1

Please sign in to comment.