diff --git a/README.md b/README.md index 6b8c4950fd1933e3a3e36aad91aad4629a878f4a..e75cf657f118c7ec6bdadad3593ba968f8ac7c2e 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ FetchContent_MakeAvailable (IHTACMakeCommon) init_project () +option (PROJECT_WITH_UNIT_TESTS "Add unit tests for project" OFF) + project (AwesomeProjectName LANGUAGES CXX C VERSION 1.0.0 @@ -53,6 +55,7 @@ ihta_add_library ( OUT_TEST TEST_TARGET # The name of the unit test target will be stored in `TEST_TARGET`. Useful for adding dependencies to the target. See below. TEST_SOURCES test/test.cpp # This adds a unit test with the given source files. TEST_INTERNALS # With this option, the internals of the library can be unit tested as well. + ADD_UNIT_TEST ${PROJECT_WITH_UNIT_TESTS} # This option can enable or disable the unit tests. ) # Add external library link to library @@ -78,7 +81,10 @@ packageProject ( # Needed so the object library knows the location of the generated headers from packageProject. target_include_directories (${LIB_TARGET} PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/PackageProjectInclude>") -target_include_directories (${TEST_TARGET} PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/PackageProjectInclude>") + +if (PROJECT_WITH_UNIT_TESTS) + target_include_directories (${TEST_TARGET} PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/PackageProjectInclude>") +endif () build_doc ( ADD_DEV_SECTION OFF