I get always an error like version: unknown error
with this:
find_package(beman.exemplar 2.1.1 EXACT REQUIRED)
The exported cmake config package
:
bash-5.2$ tree stagedir/lib/
stagedir/lib/
├── cmake
│ └── beman.exemplar
│ ├── beman.exemplar-config.cmake
│ ├── beman.exemplar-targets-relwithdebinfo.cmake
│ ├── beman.exemplar-targets.cmake
│ └── beman.exemplar-version.cmake
└── libbeman.exemplar.a
3 directories, 5 files
bash-5.2$ grep -rw PACKAGE_VERSION stagedir/lib/
stagedir/lib//cmake/beman.exemplar/beman.exemplar-version.cmake:set(PACKAGE_VERSION "2.1.1")
stagedir/lib//cmake/beman.exemplar/beman.exemplar-version.cmake:if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
stagedir/lib//cmake/beman.exemplar/beman.exemplar-version.cmake: set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
bash-5.2$
bash-5.2$ !cmake
cmake --workflow appleclang-release --fresh
Executing workflow step 1 of 3: configure preset "appleclang-release"
-- The CXX compiler identification is AppleClang 16.0.0.16000026
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is AppleClang 16.0.0.16000026
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- CMAKE_CXX_STANDARD="20" ; CMAKE_PROJECT_NAME="beman.exemplar" ; CMAKE_PROJECT_VERSION="2.1.1" ; CMAKE_SOURCE_DIR="/Users/clausklein/Workspace/cpp/beman-project/exemplar"
-- CMAKE_CXX_SCAN_FOR_MODULES="" ; PROJECT_NAME="beman.exemplar.examples" ; PROJECT_VERSION="2.1.1" ; PROJECT_SOURCE_DIR="/Users/clausklein/Workspace/cpp/beman-project/exemplar/examples"
-- Looking for __cpp_lib_ranges
-- Looking for __cpp_lib_ranges - found
-- Examples to be built: identity_direct_usage;identity_as_default_projection
-- Configuring done (2.9s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/beman-project/exemplar/build/appleclang-release
Executing workflow step 2 of 3: build preset "appleclang-release"
[0/1] Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/lib/libbeman.exemplar.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/lib/libbeman.exemplar.a(identity.cpp.o) has no symbols
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: /Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/lib/libbeman.exemplar.a the table of contents is empty (no object file members in the library define global symbols)
-- Up-to-date: /Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/include/beman/exemplar/identity.hpp
-- Up-to-date: /Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/lib/cmake/beman.exemplar/beman.exemplar-config.cmake
-- Up-to-date: /Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/lib/cmake/beman.exemplar/beman.exemplar-version.cmake
-- Up-to-date: /Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/lib/cmake/beman.exemplar/beman.exemplar-targets.cmake
-- Up-to-date: /Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/lib/cmake/beman.exemplar/beman.exemplar-targets-relwithdebinfo.cmake
Executing workflow step 3 of 3: test preset "appleclang-release"
Test project /Users/clausklein/Workspace/cpp/beman-project/exemplar/build/appleclang-release
Start 1: IdentityTest.call_identity_with_int
1/7 Test #1: IdentityTest.call_identity_with_int ...................... Passed 0.00 sec
Start 2: IdentityTest.call_identity_with_custom_type
2/7 Test #2: IdentityTest.call_identity_with_custom_type .............. Passed 0.00 sec
Start 3: IdentityTest.compare_std_vs_beman
3/7 Test #3: IdentityTest.compare_std_vs_beman ........................ Passed 0.00 sec
Start 4: IdentityTest.check_is_transparent
4/7 Test #4: IdentityTest.check_is_transparent ........................ Passed 0.00 sec
Start 5: find-package-test
5/7 Test #5: find-package-test ........................................***Failed 0.16 sec
Internal cmake changing into directory: /Users/clausklein/Workspace/cpp/beman-project/exemplar/build/appleclang-release/tests/beman/exemplar/find-package-test
======== CMake output ======
CMake Error at CMakeLists.txt:17 (find_package):
Could not find a configuration file for package "beman.exemplar" that
exactly matches requested version "2.1.1".
The following configuration files were considered but not accepted:
/Users/clausklein/Workspace/cpp/beman-project/exemplar/stagedir/lib/cmake/beman.exemplar/beman.exemplar-config.cmake, version: unknown
/Users/clausklein/.local/lib/cmake/beman.exemplar/beman.exemplar-config.cmake, version: unknown
Configuring incomplete, errors occurred!
======== End CMake output ======
Error: cmake execution failed
80% tests passed, 1 tests failed out of 5
Total Test time (real) = 0.18 sec
The following tests FAILED:
5 - find-package-test (Failed)
Errors while running CTest
bash-5.2$