Skip to content

Commit

Permalink
cmake: cxxopts is not arch independent when built with ICU support
Browse files Browse the repository at this point in the history
Since it links to an architecture dependent ICU
  • Loading branch information
dcbaker committed Mar 5, 2024
1 parent 88624fb commit 19e6f4b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmake/cxxopts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,25 @@ endfunction()

# Helper function to ecapsulate install logic
function(cxxopts_install_logic)
if(CMAKE_LIBRARY_ARCHITECTURE)
string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
if(NOT CXXOPTS_USE_UNICODE_HELP)
if(CMAKE_LIBRARY_ARCHITECTURE)
string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
else()
# On some systems (e.g. NixOS), `CMAKE_LIBRARY_ARCHITECTURE` can be empty
set(CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_DATAROOTDIR}")
endif()
if(${CMAKE_VERSION} VERSION_GREATER "3.14")
set(OPTIONAL_ARCH_INDEPENDENT "ARCH_INDEPENDENT")
endif()
else()
# On some systems (e.g. NixOS), `CMAKE_LIBRARY_ARCHITECTURE` can be empty
set(CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_DATAROOTDIR}")
set(CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}")
endif()
set(CXXOPTS_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/cxxopts" CACHE STRING "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.")
set(version_config "${PROJECT_BINARY_DIR}/cxxopts-config-version.cmake")
set(project_config "${PROJECT_BINARY_DIR}/cxxopts-config.cmake")
set(targets_export_name cxxopts-targets)
set(PackagingTemplatesDir "${PROJECT_SOURCE_DIR}/packaging")


if(${CMAKE_VERSION} VERSION_GREATER "3.14")
set(OPTIONAL_ARCH_INDEPENDENT "ARCH_INDEPENDENT")
endif()

# Generate the version, config and target files into the build directory.
write_basic_package_version_file(
${version_config}
Expand Down

0 comments on commit 19e6f4b

Please sign in to comment.