From 95d71ed8e83c01aa9025b4df4c811eb9a219cd3b Mon Sep 17 00:00:00 2001 From: NUCLEAR-BOMB <61628949+NUCLEAR-BOMB@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:26:57 +0500 Subject: [PATCH] Don't generate `option-test`, `option-codegen-test` and other targets when `OPTION_INSTALL` is `TRUE` --- CMakeLists.txt | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd09a00..6dbb1de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,33 +36,29 @@ if (OPTION_USE_NATSTEPFILTER) target_sources(option INTERFACE $) endif() -if (OPTION_INSTALL) - set(exclude_from_all EXCLUDE_FROM_ALL) -endif() - -if (DEFINED OPTION_EXTRA_FLAGS) - separate_arguments(OPTION_EXTRA_FLAGS) - add_compile_options(${OPTION_EXTRA_FLAGS}) - add_link_options(${OPTION_EXTRA_FLAGS}) -endif() - -if (OPTION_TEST) - add_subdirectory(test ${exclude_from_all}) -endif() - -if (OPTION_EXAMPLES) - add_subdirectory(examples ${exclude_from_all}) -endif() - -if (OPTION_BENCHMARK) - add_subdirectory(benchmark ${exclude_from_all}) -endif() - -if (OPTION_CODEGEN_TEST) - add_subdirectory(test/codegen ${exclude_from_all}) -endif() - -if (OPTION_INSTALL) +if (NOT OPTION_INSTALL) + if (DEFINED OPTION_EXTRA_FLAGS) + separate_arguments(OPTION_EXTRA_FLAGS) + add_compile_options(${OPTION_EXTRA_FLAGS}) + add_link_options(${OPTION_EXTRA_FLAGS}) + endif() + + if (OPTION_TEST) + add_subdirectory(test ${exclude_from_all}) + endif() + + if (OPTION_EXAMPLES) + add_subdirectory(examples ${exclude_from_all}) + endif() + + if (OPTION_BENCHMARK) + add_subdirectory(benchmark ${exclude_from_all}) + endif() + + if (OPTION_CODEGEN_TEST) + add_subdirectory(test/codegen ${exclude_from_all}) + endif() +else() # ^^^ NOT OPTION_INSTALL / vvv OPTION_INSTALL include(CMakePackageConfigHelpers) include(GNUInstallDirs)