Add MAIN_PROJECT check for test and install options#2514
Merged
Conversation
|
Can you teach me c++ |
Contributor
|
For reference, here is the same purpose code from {fmt} # Determine if fmt is built as a subproject (using add_subdirectory)
# or if it is the master project.
set(MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MASTER_PROJECT ON)
message(STATUS "CMake version: ${CMAKE_VERSION}")
endif ()
...
...
...
# Options that control generation of various targets.
option(FMT_DOC "Generate the doc target." ${MASTER_PROJECT})
option(FMT_INSTALL "Generate the install target." ${MASTER_PROJECT})
option(FMT_TEST "Generate the test target." ${MASTER_PROJECT})
option(FMT_FUZZ "Generate the fuzz target." OFF)
option(FMT_CUDA_TEST "Generate the cuda-test target." OFF)
option(FMT_OS "Include core requiring OS (Windows/Posix) " ON)So it might be a good idea at least copy explanatory comment and maybe use |
nlohmann
requested changes
Dec 12, 2020
nlohmann
reviewed
Dec 14, 2020
nlohmann
requested changes
Dec 14, 2020
Owner
nlohmann
left a comment
There was a problem hiding this comment.
A last change request, otherwise looks good to me.
Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
Owner
|
Thanks! |
Contributor
Author
|
@nlohmann Thank you 👍🏻 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This resolves #2513 by checking if this is the main project in a CMake project tree.
JSON_BuildTestsandJSON_Installwill only be set toONif this is the main project.CTest will only be included, if
JSON_BuildTestsis set toON.BUILD_TESTINGwill therefore only be set, if this is the main project.Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmanndirectory, runmake amalgamateto create the single-header filesingle_include/nlohmann/json.hpp. The whole process is described here.