Conversation
Convert to an interface library and use verify headers to test that headers are self-contained and compile correctly by themselves. Test install at end of CI and run both Asan and RWDI builds.
Add the verify headers target to the build presets for each compiler.
Add the EXPORT component for the header install components.
|
It's a relatively new Cmake feature, but getting rid of the static library
is a win.
College tour tomorrow, so I'll miss the meeting, but please do bring it up.
…On Sun, Nov 10, 2024, 17:11 Darius Neațu ***@***.***> wrote:
***@***.**** approved this pull request.
Interesting. I think we should add this idea to our tomorrow's agenda.
I'm what others think.
—
Reply to this email directly, view it on GitHub
<#75 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVNZ5WCAX4THWO2FVKTE3LZ77KY7AVCNFSM6AAAAABRQRTOM2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDIMRVHA3DKMZUGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Add back FindPackage support.
Lint failed. Fixed indentation.
| install( | ||
| EXPORT beman_optional26_export | ||
| DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/optional26/ | ||
| NAMESPACE Beman::Optional26:: |
There was a problem hiding this comment.
| NAMESPACE Beman::Optional26:: | |
| NAMESPACE beman::optional26:: |
?
|
|
||
| # Create the library target and named header set for beman_optional26 | ||
| add_library(beman_optional26 STATIC) | ||
| add_library(beman_optional26 INTERFACE) |
There was a problem hiding this comment.
I can fix this up as part of the PR. Need to merge in other changes in any case.
There was a problem hiding this comment.
That would be great. But feel free to speed-up/skip steps today if you need something in main for Poland.
There was a problem hiding this comment.
Note: that will end in very strange behaviour! Normally I use something like this:
find_package(Boost CONFIG QUIET)
if(TARGET Boost::headers AND TARGET fmt::fmt)
add_executable(to_string to_string.cpp)
target_link_libraries(to_string fmt::fmt Boost::headers)
endif()There was a problem hiding this comment.
This is creating the target that gets the named header file_set added to it? It's up here to avoid ordering problems between subdirectories.
|
@steve-downey , please proceed with this PR. We discussed yesterday in the sync and it's OK to propose this standard cmake practice in the Beman standard (same document, a new CMAKE.$NAME rule). Can you add this recommendation? If you cannot help with that, I can do it after Poland week (in 2-3 weeks). |
Names of the header set, install component, or all of the above? |
It sounds like it's a good idea to put in standard all of the above. I would approve that, and David was also happy about your PR. It's true that we had only 5 people in the last sync. If you want to get more feedback, do a discourse thread, but I would go directly with the PR in BEMAN_STANDARD.md. |
|
this PR ends in this Also the Usage: cmake_minimum_required(VERSION 3.27...3.31)
project(beman_optional26_example VERSION 0.0.0 LANGUAGES CXX)
set(BEMAN_OPTIONAL26_LIBRARY "Beman::Optional26::beman_optional26")
if(PROJECT_IS_TOP_LEVEL)
find_package(Beman::Optional26 0.0.0 EXACT REQUIRED)
endif()Result: |
|
A Why install under |
bash-5.2$ cmake -S . -G Ninja -B .build -D CMAKE_PREFIX_PATH=../.install/clang-19
CMake Error at CMakeLists.txt:13 (find_package):
Could not find a configuration file for package "beman_optional26" that
exactly matches requested version "0.0.0".
The following configuration files were considered but not accepted:
/Users/clausklein/Workspace/cpp/beman-project/optional26/.install/clang-19/lib/cmake/beman_optional26/beman_optional26-config.cmake, version: unknown
-- Configuring incomplete, errors occurred!
bash-5.2$ |
Habit, I suppose? Easier to always disambiguate than sort out of its strictly necessary. |
|
I'll work on the installation bugs and catch up with the Beman Standard in follow on PRs. |

Convert to an INTERFACE target rather than static library and use the new-ish cmake verify headers mechanism to test that the headers compile and are stand alone.