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)