Skip to content
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

Including CTest in the top-level CMakeLists.txt sets BUILD_TESTING=ON for parent projects #2513

Closed
1 of 3 tasks
globberwops opened this issue Dec 9, 2020 · 0 comments · Fixed by #2514
Closed
1 of 3 tasks
Assignees
Labels
kind: bug release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@globberwops
Copy link
Contributor

What is the issue you have?

BUILD_TESTING is unset in the main project.
nlohmann_json is included in a main project using FetchContent.
JSON_BuildTests=OFF is set in the main project.
nlohmann_json's top-level CMakeLists.txt includes CTest regardless.
BUILD_TESTING=ON is now set in the main project.

Please describe the steps to reproduce the issue.

message(STATUS "before BUILD_TESTING := ${BUILD_TESTING}") # prints ""
include(FetchContent)
FetchContent_Declare(
  nlohmann_json
  GIT_REPOSITORY https://github.com/nlohmann/json.git
  GIT_TAG develop)
set(JSON_BuildTests OFF)
FetchContent_MakeAvailable(nlohmann_json)
message(STATUS "after BUILD_TESTING := ${BUILD_TESTING}") # prints ON

What is the expected behavior?

CTest should only be included if nlohmann_json is the main project.

And what is the actual behavior instead?

CTest is included although nlohmann_json is added as subproject.

Which version of the library did you use?

  • latest release version 3.9.1
  • other release - please state the version: ___
  • the develop branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants