diff --git a/cmake/cxxopts.cmake b/cmake/cxxopts.cmake index b4d6c464..b26c18a8 100644 --- a/cmake/cxxopts.cmake +++ b/cmake/cxxopts.cmake @@ -87,11 +87,18 @@ 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") @@ -99,11 +106,6 @@ function(cxxopts_install_logic) 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}