-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot compile glaze example because of the CMake error #1615
Comments
If you want to build the tests/examples then the recommended approach is to clone Glaze and run CMake. By default Glaze doesn't build tests when including in another project. There is a |
Thank you for the quick response. I compile my examples outside the glaze source folder (using FetchContent). This is my CMakeLists.txt, and you can find the content of include(${PROJECT_SOURCE_DIR}/cmake/catch2.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/glaze.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/nanobench.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/boost.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/rapidjson.cmake)
# We cannot compile Glaze examples using clang++
set(CMAKE_CXX_COMPILER g++)
set(TEST_FILES glaze_test)
foreach(SRC_FILE ${TEST_FILES})
add_executable(${SRC_FILE} ${SRC_FILE}.cpp)
target_link_libraries(
${SRC_FILE} PRIVATE Catch2::Catch2WithMain fmt::fmt glaze::glaze nanobench
Boost::json utilities)
target_include_directories(${SRC_FILE} PRIVATE ${rapidjson_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR})
add_test(${SRC_FILE} ${SRC_FILE})
endforeach(SRC_FILE)
enable_testing() |
I use g++ instead of clang++ (v19.1.7) to fix compilation failures.
|
Clang requires the flag |
I could not compile Glaze's examples using CMake's
FetchContent
. Everything works perfectly when I remove the in-source check from theprelude.cmake
file. What am I missing?The error message
My glaze.cmake file
The text was updated successfully, but these errors were encountered: