From 525bd161cf5d356bc61105771241a5dec7f1180e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 14 Jan 2022 04:32:33 +0400 Subject: [PATCH] Use return more for less indentations --- external/gsl/CMakeLists.txt | 11 +++++------ external/openal/CMakeLists.txt | 20 ++++++++++---------- external/ranges/CMakeLists.txt | 23 +++++++++++------------ 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/external/gsl/CMakeLists.txt b/external/gsl/CMakeLists.txt index b03be4f..1bfab92 100644 --- a/external/gsl/CMakeLists.txt +++ b/external/gsl/CMakeLists.txt @@ -16,12 +16,11 @@ if (DESKTOP_APP_USE_PACKAGED) if (Microsoft.GSL_FOUND) target_link_libraries(external_gsl INTERFACE Microsoft.GSL::GSL) + return() endif() endif() -if (NOT Microsoft.GSL_FOUND) - target_include_directories(external_gsl SYSTEM - INTERFACE - ${third_party_loc}/GSL/include - ) -endif() +target_include_directories(external_gsl SYSTEM +INTERFACE + ${third_party_loc}/GSL/include +) diff --git a/external/openal/CMakeLists.txt b/external/openal/CMakeLists.txt index cd3eedf..1e10bb7 100644 --- a/external/openal/CMakeLists.txt +++ b/external/openal/CMakeLists.txt @@ -12,11 +12,13 @@ if (DESKTOP_APP_USE_PACKAGED) if (OPENAL_FOUND) target_include_directories(external_openal SYSTEM INTERFACE ${OPENAL_INCLUDE_DIR}) target_link_libraries(external_openal INTERFACE ${OPENAL_LIBRARY}) - else() - find_package(PkgConfig REQUIRED) - pkg_check_modules(OPENAL REQUIRED IMPORTED_TARGET openal) - target_link_libraries(external_openal INTERFACE PkgConfig::OPENAL) + return() endif() + + find_package(PkgConfig REQUIRED) + pkg_check_modules(OPENAL REQUIRED IMPORTED_TARGET openal) + target_link_libraries(external_openal INTERFACE PkgConfig::OPENAL) + return() elseif (WIN32) target_include_directories(external_openal SYSTEM INTERFACE @@ -49,9 +51,7 @@ else() ) endif() -if (NOT DESKTOP_APP_USE_PACKAGED) - target_compile_definitions(external_openal - INTERFACE - AL_LIBTYPE_STATIC - ) -endif() +target_compile_definitions(external_openal +INTERFACE + AL_LIBTYPE_STATIC +) diff --git a/external/ranges/CMakeLists.txt b/external/ranges/CMakeLists.txt index 5a584dd..bc4e223 100644 --- a/external/ranges/CMakeLists.txt +++ b/external/ranges/CMakeLists.txt @@ -16,20 +16,19 @@ if (DESKTOP_APP_USE_PACKAGED) if (range-v3_FOUND) target_link_libraries(external_ranges INTERFACE range-v3::range-v3) + return() endif() endif() -if (NOT range-v3_FOUND) - target_include_directories(external_ranges SYSTEM - INTERFACE - ${third_party_loc}/range-v3/include - ) +target_include_directories(external_ranges SYSTEM +INTERFACE + ${third_party_loc}/range-v3/include +) - if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_options(external_ranges - INTERFACE - /Zc:preprocessor # need for range-v3 see https://github.com/ericniebler/range-v3#supported-compilers - /wd5105 # needed for `/Zc:preprocessor`, suppressing C5105 "macro expansion producing 'defined' has undefined behavior" - ) - endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(external_ranges + INTERFACE + /Zc:preprocessor # need for range-v3 see https://github.com/ericniebler/range-v3#supported-compilers + /wd5105 # needed for `/Zc:preprocessor`, suppressing C5105 "macro expansion producing 'defined' has undefined behavior" + ) endif() \ No newline at end of file