Skip to content

Commit

Permalink
Update tests creation condition
Browse files Browse the repository at this point in the history
Don't create tests for this project when included as a sub_project
This requires cmake 3.21
  • Loading branch information
Ergus committed Mar 29, 2024
1 parent 6963faa commit 8fe6582
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.21)

project(ArgParserC LANGUAGES C CXX)

Expand Down Expand Up @@ -41,8 +41,10 @@ add_executable (test_cpp main.cpp)
target_link_libraries (test_cpp argparser)
target_compile_features(test_cpp PUBLIC cxx_std_17)

# All these are only for tests, not built in release mode.
if (NOT CMAKE_BUILD_TYPE MATCHES "^Rel")
# All these are only for tests:
# not built in release mode.
# not build when used as a submodule
if ((NOT CMAKE_BUILD_TYPE MATCHES "^Rel") AND (PROJECT_IS_TOP_LEVEL))

enable_testing()

Expand Down

0 comments on commit 8fe6582

Please sign in to comment.