-
Notifications
You must be signed in to change notification settings - Fork 543
Skip building tests by default #993
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
Changes from all commits
f40a8b4
7120e2a
6ac4c03
e288860
90e0ecc
c98ef25
22327be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious if this will work, but I haven't tested it: if(NOT BUILD_TESTING)
set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL TRUE)
endif() (and then the remainder of the file is reverted to as-it-was). IIUC, this should exclude every added target from the implicit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with the suggestion to exclude test targets from Example: Targets in the examples directory are currently excluded from the all target with: add_custom_target(examples DEPENDS ${MONGOCXX_EXAMPLE_EXECUTABLES} ${BSONCXX_EXAMPLE_EXECUTABLES}) But the example targets are still defined. CMake targets can be listed with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem to work when I try it. The test programs are built by default when I implement this like so:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if I can figure why the directory property doesn't work, so just discard that suggestion for now. On the other hand, the BUILD_TESTING variable should work? Are you sure to clear it from your cache before configuring? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I found the issue, and after applying the fix below, your suggestion then works. I pushed these changes and the tests are green. - set(ENABLE_TESTS OLD_ENABLE_TESTS)
- set(BUILD_TESTING OLD_BUILD_TESTING)
+ set(ENABLE_TESTS ${OLD_ENABLE_TESTS})
+ set(BUILD_TESTING ${OLD_BUILD_TESTING}) |
||
if(NOT BUILD_TESTING) | ||
set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL TRUE) | ||
endif() | ||
|
||
include_directories( | ||
${MONGO_CXX_DRIVER_SOURCE_DIR}/src/third_party/catch/include | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CMake has an semi-built-in option for this feature,
BUILD_TESTING
. At the topCMakeLists.txt
, add: