Skip to content

Conversation

@JeffGarland
Copy link
Member

@JeffGarland JeffGarland commented Dec 25, 2025

See comments for details but some general cleanup to fix cmake. One more change coming to remove src directory.

target_sources(${example} PRIVATE ${example}.cpp)
target_link_libraries(
beman.take_before.examples.${example}
${example}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplifies naming before

jeff@ub25-04:~/dev/take_before/build$ ls -ltr examples/
total 196
-rwxrwxr-x 1 jeff jeff 92448 Dec 25 08:13 beman.take_before.examples.take_before_as_default_projection
-rwxrwxr-x 1 jeff jeff 89344 Dec 25 08:13 beman.take_before.examples.take_before_direct_usage

after:

-rwxrwxr-x 1 jeff jeff 92448 Dec 25 08:16 take_before_as_default_projection
-rwxrwxr-x 1 jeff jeff 89344 Dec 25 08:16 take_before_direct_usage

# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.28...4.2)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR coming for examplar to update this -- 3.28 is minimum for modules and should be our standard now. We've decided range for cmake is best practice

#if __cplusplus < 202002L
#error "C++20 or later is required"
#endif
// clang-format on
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also needs to be added to our best practices -- give a nice user error if the CXX version isn't high enough

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header only so removed this to simplify repo -- needed stuff moved to cmake in base directory

@coveralls
Copy link

coveralls commented Dec 25, 2025

Pull Request Test Coverage Report for Build 20512376993

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 20435500339: 0.0%
Covered Lines: 31
Relevant Lines: 31

💛 - Coveralls

@JeffGarland
Copy link
Member Author

The CI is mostly happy here except for MSVC. The flag passed appears to be wrong -std:c++latest instead fo /std:c++latest-- looks like a CI system bug

C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe  /nologo /TP -DCMAKE_INTDIR=\"Debug\" -ID:\a\take_before\take_before\include /DWIN32 /D_WINDOWS /EHsc /EHsc /permissive-  /Zi /Ob0 /Od /RTC1 -std:c++latest -MDd /showIncludes /Foexamples\CMakeFiles\take_before_direct_usage.dir\Debug\take_before_direct_usage.cpp.obj /Fdexamples\CMakeFiles\take_before_direct_usage.dir\Debug\ /FS -c D:\a\take_before\take_before\examples\take_before_direct_usage.cpp
D:\a\take_before\take_before\include\beman/take_before/take_before.hpp(16): fatal error C1189: #error:  "C++20 or later is required"

Comment on lines 15 to 21
#if defined(_MSVC_LANG)
#if _MSVC_LANG < 202002L
#error "C++20 or later is required"
#endif
#elif __cplusplus < 202002L
#error "C++20 or later is required"
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSVC does not correctly define __cplusplus by default. Added _MSVC_LANG check as a fallback

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh, of course it doesn't :( They do look like they set the concepts flag properly which is probably a better check anyway. I've switched it to that

https://godbolt.org/z/fn5PY1cvG

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the CI flags still look wrong to me, but after your change it did work so hmm...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it worked - great. @nora77zz I think this is ready?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, looks good. Thanks

@JeffGarland JeffGarland merged commit 6810506 into main Dec 26, 2025
76 checks passed
add_library(beman::take_before ALIAS beman.take_before)
set_target_properties(beman.take_before PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON)

set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/infra/cmake)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updates for cmake and project structure

5 participants