Skip to content

Commit

Permalink
Add ARCH_INDEPENDENT flag in CMakeLists.txt
Browse files Browse the repository at this point in the history
If this package is flagged as ARCH_IDENPENDENT by cmake it is possible to consume the generated cmake files for compiling both 32bit and 64bit projects. Otherwise cmake will complain:
CMake Error at CMakeLists.txt:12 (find_package):
  Could not find a configuration file for package "cereal" that is compatible
  with requested version "".

  The following configuration files were considered but not accepted:

   cmake/cereal/cerealConfig.cmake, version: 1.3.2 (64bit)

Ive also added a version check to retain the compability with cmake
older than 3.14.

For more info about this flag look here:
https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html
  • Loading branch information
astralaster authored and AzothAmmo committed Apr 24, 2023
1 parent b2d68c5 commit 83b6fa0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ if(CEREAL_INSTALL)
${configFile}
INSTALL_DESTINATION ${configInstallDestination}
)
write_basic_package_version_file(
${versionFile}
COMPATIBILITY SameMajorVersion
)
if(${CMAKE_VERSION} VERSION_GREATER 3.13)
write_basic_package_version_file("${versionFile}" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
else()
write_basic_package_version_file("${versionFile}" COMPATIBILITY SameMajorVersion)
endif()

install(FILES ${configFile} ${versionFile} DESTINATION ${configInstallDestination})
install(
Expand Down

0 comments on commit 83b6fa0

Please sign in to comment.