Add STDEXEC_MAIN_PROJECT and STDEXEC_INSTALL to CMake#1931
Add STDEXEC_MAIN_PROJECT and STDEXEC_INSTALL to CMake#1931mathisloge wants to merge 3 commits intoNVIDIA:mainfrom
Conversation
ericniebler
left a comment
There was a problem hiding this comment.
this looks good. just one comment.
| # CMake project, unless they explicitly set STDEXEC_BUILD_TESTS=TRUE, | ||
| # or they enabled CTest's BUILD_TESTING option | ||
| if ((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) OR BUILD_TESTING) | ||
| if (STDEXEC_MAIN_PROJECT OR BUILD_TESTING) |
There was a problem hiding this comment.
did you say you were replacing uses of BUILD_TESTING?
There was a problem hiding this comment.
Oh yeah, that was one question I wanted to ask:
I wanted to add STDEXEC_MAIN_PROJECT AND BUILD_TESTING (changed OR -> AND) to have the following behavior:
if STDEXEC_MAIN_PROJECT then use BUILD_TESTING as a default value of STDEXEC_BUILD_TESTS
if not STDEXEC_MAIN_PROJECT default to FALSE as a default value of STDEXEC_BUILD_TESTS.
Therefore if using stdexec as a top level project, you could either use BUILD_TESTING or STDEXEC_BUILD_TESTS and for cases where stdexec is used as a subproject one have to use STDEXEC_BUILD_TESTS to enable tests.
Would that be an accaptable default behavior?
|
/ok to test b9a585f |
It is common practice to be able to disable install targets because they can conflict with in-tree builds (for example when
stdexecis added via CPM).Most projects use a top-level project check to enable installs by default when
stdexecis the main project and otherwise disable them. I've applied the same pattern here and also replaced the remainingBUILD_TESTINGusages withSTDEXEC_BUILD_TESTS.stdexecis the top-level project.STDEXEC_MAIN_PROJECTandSTDEXEC_INSTALL.BUILD_TESTINGwithSTDEXEC_BUILD_TESTS.asioexec,tbbexec, etc., to avoid conflicts when used as a dependency.At least resolves my pain with the install targets when pulling stdexec via CPM/FetchContent or add_subdirectory.