diff --git a/CMakeLists.txt b/CMakeLists.txt index b99ddfe6c..3f0244a9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.13) cmake_policy(SET CMP0028 NEW) # Double colon in target name means ALIAS or IMPORTED target. cmake_policy(SET CMP0048 NEW) # The ``project()`` command manages VERSION variables. @@ -46,42 +46,15 @@ if(USE_CCACHE) endif() endif() -# TODO: check that 'decltype' compiles -# TODO: check that 'constexpr' compiles -if(NOT Vc_COMPILER_IS_MSVC) # MSVC doesn't provide a switch to turn C++11 on/off AFAIK - AddCompilerFlag("-std=c++14" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS) - if(NOT _ok) - AddCompilerFlag("-std=c++1y" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS) - if(NOT _ok) - AddCompilerFlag("-std=c++11" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS) - if(NOT _ok) - AddCompilerFlag("-std=c++0x" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS) - if(NOT _ok) - message(FATAL_ERROR "Vc 1.x requires C++11, better even C++14. It seems this is not available. If this was incorrectly determined please notify vc-devel@compeng.uni-frankfurt.de") - endif() - endif() - endif() - endif() -elseif(MSVC_VERSION LESS 1900) - message(FATAL_ERROR "Vc 1.x requires at least Visual Studio 2015.") -endif() +add_library(Vc STATIC) +target_compile_features(Vc PUBLIC cxx_std_11) if(Vc_COMPILER_IS_GCC) - if(Vc_GCC_VERSION VERSION_GREATER "5.0.0" AND Vc_GCC_VERSION VERSION_LESS "6.0.0") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0.0") UserWarning("GCC 5 goes into an endless loop comiling example_scaling_scalar. Therefore, this target is disabled.") - list(APPEND disabled_targets - example_scaling_scalar - ) + list(APPEND disabled_targets example_scaling_scalar) endif() elseif(Vc_COMPILER_IS_MSVC) - if(MSVC_VERSION LESS 1700) - # MSVC before 2012 has a broken std::vector::resize implementation. STL + Vc code will probably not compile. - # UserWarning in VcMacros.cmake - list(APPEND disabled_targets - stlcontainer_sse - stlcontainer_avx - ) - endif() # Disable warning "C++ exception specification ignored except to indicate a function is not __declspec(nothrow)" # MSVC emits the warning for the _UnitTest_Compare desctructor which needs the throw declaration so that it doesn't std::terminate AddCompilerFlag("/wd4290") @@ -89,20 +62,15 @@ endif() vc_set_preferred_compiler_flags(WARNING_FLAGS BUILDTYPE_FLAGS) -add_definitions(${Vc_DEFINITIONS}) -add_compile_options(${Vc_COMPILE_FLAGS}) +target_compile_definitions(Vc PUBLIC ${Vc_DEFINITIONS}) +target_compile_definitions(Vc PRIVATE Vc_COMPILE_LIB) +target_compile_options(Vc PUBLIC ${Vc_COMPILE_FLAGS}) if(Vc_COMPILER_IS_INTEL) # per default icc is not IEEE compliant, but we need that for verification AddCompilerFlag("-fp-model source") endif() -if(CMAKE_BUILD_TYPE STREQUAL "" AND NOT CMAKE_CXX_FLAGS MATCHES "-O[123]") - message(STATUS "WARNING! It seems you are compiling without optimization. Please set CMAKE_BUILD_TYPE.") -endif(CMAKE_BUILD_TYPE STREQUAL "" AND NOT CMAKE_CXX_FLAGS MATCHES "-O[123]") - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) # ${CMAKE_CURRENT_SOURCE_DIR}/include) - add_custom_target(other VERBATIM) add_custom_target(Scalar COMMENT "build Scalar code" VERBATIM) add_custom_target(SSE COMMENT "build SSE code" VERBATIM) @@ -111,25 +79,23 @@ add_custom_target(AVX2 COMMENT "build AVX2 code" VERBATIM) AddCompilerFlag(-ftemplate-depth=128 CXX_FLAGS CMAKE_CXX_FLAGS) -set(libvc_compile_flags "-DVc_COMPILE_LIB") +set(libvc_compile_flags) AddCompilerFlag("-fPIC" CXX_FLAGS libvc_compile_flags) # -fstack-protector is the default of GCC, but at least Ubuntu changes the default to -fstack-protector-strong, which is crazy AddCompilerFlag("-fstack-protector" CXX_FLAGS libvc_compile_flags) -set(_srcs src/const.cpp) +target_sources(Vc PRIVATE src/const.cpp) if(Vc_X86) - list(APPEND _srcs src/cpuid.cpp src/support_x86.cpp) - vc_compile_for_all_implementations(_srcs src/trigonometric.cpp ONLY SSE2 SSE3 SSSE3 SSE4_1 AVX SSE+XOP+FMA4 AVX+XOP+FMA4 AVX+XOP+FMA AVX+FMA AVX2+FMA+BMI2) - vc_compile_for_all_implementations(_srcs src/sse_sorthelper.cpp ONLY SSE2 SSE4_1 AVX AVX2+FMA+BMI2) - vc_compile_for_all_implementations(_srcs src/avx_sorthelper.cpp ONLY AVX AVX2+FMA+BMI2) -elseif(Vc_ARM) - list(APPEND _srcs src/support_dummy.cpp) + target_sources(Vc PRIVATE src/cpuid.cpp src/support_x86.cpp) + vc_compile_for_all_implementations(src/trigonometric.cpp ONLY SSE2 SSE3 SSSE3 SSE4_1 AVX SSE+XOP+FMA4 AVX+XOP+FMA4 AVX+XOP+FMA AVX+FMA AVX2+FMA+BMI2) + vc_compile_for_all_implementations(src/sse_sorthelper.cpp ONLY SSE2 SSE4_1 AVX AVX2+FMA+BMI2) + vc_compile_for_all_implementations(src/avx_sorthelper.cpp ONLY AVX AVX2+FMA+BMI2) else() - list(APPEND _srcs src/support_dummy.cpp) + target_sources(Vc PRIVATE src/support_dummy.cpp) endif() -add_library(Vc STATIC ${_srcs}) -set_property(TARGET Vc APPEND PROPERTY COMPILE_OPTIONS ${libvc_compile_flags}) + +target_compile_options(Vc PRIVATE ${libvc_compile_flags}) add_target_property(Vc LABELS "other") if(XCODE) # TODO: document what this does and why it has no counterpart in the non-XCODE logic @@ -245,12 +211,12 @@ configure_file(${PROJECT_SOURCE_DIR}/CTestCustom.cmake ${PROJECT_BINARY_DIR}/CTe if(BUILD_TESTING) add_custom_target(build_tests ALL VERBATIM) add_subdirectory(tests) -endif(BUILD_TESTING) +endif() set(BUILD_EXAMPLES FALSE CACHE BOOL "Build examples.") if(BUILD_EXAMPLES) add_subdirectory(examples) -endif(BUILD_EXAMPLES) +endif() # Hide Vc_IMPL as it is only meant for users of Vc mark_as_advanced(Vc_IMPL) diff --git a/Vc/common/span.h b/Vc/common/span.h index 1687834fe..4080f6f41 100644 --- a/Vc/common/span.h +++ b/Vc/common/span.h @@ -520,7 +520,7 @@ template class span #ifdef __cpp_lib_byte // Disable _as_bytes() for older MSVC versions as it leads to a compilation error due to a compiler bug. // When parsing the return type, MSVC will instantiate the primary template of span<> and static_assert(). -#if _MSC_VER > 1928 +#if defined(_MSC_VER) && _MSC_VER > 1928 span _as_bytes() const noexcept { return {reinterpret_cast(data()), size_bytes()}; diff --git a/cmake/AddTargetProperty.cmake b/cmake/AddTargetProperty.cmake index 8e4faaafc..8a009f4d9 100644 --- a/cmake/AddTargetProperty.cmake +++ b/cmake/AddTargetProperty.cmake @@ -30,7 +30,7 @@ macro(add_target_property _target _prop _value) get_target_property(_oldprop "${_target}" ${_prop}) if(NOT _oldprop) set_target_properties("${_target}" PROPERTIES ${_prop} "${_value}") - else(NOT _oldprop) + else() set_target_properties("${_target}" PROPERTIES ${_prop} "${_oldprop} ${_value}") - endif(NOT _oldprop) + endif() endmacro(add_target_property) diff --git a/cmake/CheckCXXCompilerFlag.cmake b/cmake/CheckCXXCompilerFlag.cmake index e3b0188a4..8ecd419a9 100644 --- a/cmake/CheckCXXCompilerFlag.cmake +++ b/cmake/CheckCXXCompilerFlag.cmake @@ -69,5 +69,5 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX " #10353: " # ICC: option '-mfma' ignored, suggest using '-march=core-avx2' ) SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") -ENDMACRO (CHECK_CXX_COMPILER_FLAG) +ENDMACRO () diff --git a/cmake/VcMacros.cmake b/cmake/VcMacros.cmake index 3fce7a7fd..b26d1ac56 100644 --- a/cmake/VcMacros.cmake +++ b/cmake/VcMacros.cmake @@ -32,12 +32,11 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #============================================================================= -cmake_minimum_required(VERSION 2.8.3...3.13) +cmake_minimum_required(VERSION 3.13) -get_filename_component(_currentDir "${CMAKE_CURRENT_LIST_FILE}" PATH) -include ("${_currentDir}/UserWarning.cmake") -include ("${_currentDir}/AddCompilerFlag.cmake") -include ("${_currentDir}/OptimizeForArchitecture.cmake") +include ("${CMAKE_CURRENT_LIST_DIR}/UserWarning.cmake") +include ("${CMAKE_CURRENT_LIST_DIR}/AddCompilerFlag.cmake") +include ("${CMAKE_CURRENT_LIST_DIR}/OptimizeForArchitecture.cmake") macro(vc_determine_compiler) if(NOT DEFINED Vc_COMPILER_IS_INTEL) @@ -47,74 +46,30 @@ macro(vc_determine_compiler) set(Vc_COMPILER_IS_CLANG false) set(Vc_COMPILER_IS_MSVC false) set(Vc_COMPILER_IS_GCC false) - if(CMAKE_CXX_COMPILER MATCHES "/(icpc|icc)$") + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(Vc_COMPILER_IS_INTEL true) - exec_program(${CMAKE_CXX_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE Vc_ICC_VERSION) - message(STATUS "Detected Compiler: Intel ${Vc_ICC_VERSION}") - - # break build with too old clang as early as possible. - if(Vc_ICC_VERSION VERSION_LESS 18.0.0) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) message(FATAL_ERROR "Vc 1.4 requires least ICC 18") endif() elseif(CMAKE_CXX_COMPILER MATCHES "(opencc|openCC)$") set(Vc_COMPILER_IS_OPEN64 true) - message(STATUS "Detected Compiler: Open64") - elseif(CMAKE_CXX_COMPILER MATCHES "clang\\+\\+$" OR "${_cxx_compiler_version}" MATCHES "clang") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(Vc_COMPILER_IS_CLANG true) - exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE Vc_CLANG_VERSION) - string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" Vc_CLANG_VERSION "${Vc_CLANG_VERSION}") - message(STATUS "Detected Compiler: Clang ${Vc_CLANG_VERSION}") - - # break build with too old clang as early as possible. - if(Vc_CLANG_VERSION VERSION_LESS 3.4) - message(FATAL_ERROR "Vc 1.x requires C++11 support. This requires at least clang 3.4") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.7.0) + message(FATAL_ERROR "Clang 3.6 has serious issues with AVX code generation\nPlease update to a more recent clang version.\n") endif() elseif(MSVC) set(Vc_COMPILER_IS_MSVC true) - message(STATUS "Detected Compiler: MSVC ${MSVC_VERSION}") + if(MSVC_VERSION LESS 1900) + message(FATAL_ERROR "Vc 1.x requires at least Visual Studio 2015.") + endif() elseif(CMAKE_COMPILER_IS_GNUCXX) set(Vc_COMPILER_IS_GCC true) - exec_program(${CMAKE_CXX_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE Vc_GCC_VERSION) - message(STATUS "Detected Compiler: GCC ${Vc_GCC_VERSION}") - - # some distributions patch their GCC to return nothing or only major and minor version on -dumpversion. - # In that case we must extract the version number from --version. - if(NOT Vc_GCC_VERSION OR Vc_GCC_VERSION MATCHES "^[0-9]\\.[0-9]+$") - exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE Vc_GCC_VERSION) - string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" Vc_GCC_VERSION "${Vc_GCC_VERSION}") - message(STATUS "GCC Version from --version: ${Vc_GCC_VERSION}") - endif() - - # some distributions patch their GCC to be API incompatible to what the FSF released. In - # those cases we require a macro to identify the distribution version - find_program(Vc_lsb_release lsb_release) - mark_as_advanced(Vc_lsb_release) - if(Vc_lsb_release) - if(NOT Vc_distributor_id) - execute_process(COMMAND ${Vc_lsb_release} -is OUTPUT_VARIABLE Vc_distributor_id OUTPUT_STRIP_TRAILING_WHITESPACE) - string(TOUPPER "${Vc_distributor_id}" Vc_distributor_id) - set(Vc_distributor_id "${Vc_distributor_id}" CACHE STRING "lsb distribution id") - execute_process(COMMAND ${Vc_lsb_release} -rs OUTPUT_VARIABLE Vc_distributor_release OUTPUT_STRIP_TRAILING_WHITESPACE) - set(Vc_distributor_release "${Vc_distributor_release}" CACHE STRING "lsb release id") - endif() - if(Vc_distributor_id STREQUAL "UBUNTU") - execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE _gcc_version) - string(REGEX MATCH "\\(.* ${Vc_GCC_VERSION}-([0-9]+).*\\)" _tmp "${_gcc_version}") - if(_tmp) - set(_patch ${CMAKE_MATCH_1}) - string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _tmp "${Vc_distributor_release}") - execute_process(COMMAND printf 0x%x%02x%02x ${CMAKE_MATCH_1} ${CMAKE_MATCH_2} ${_patch} OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE _tmp) - set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -D__GNUC_UBUNTU_VERSION__=${_tmp}") - endif() - endif() - endif() - - # break build with too old GCC as early as possible. - if(Vc_GCC_VERSION VERSION_LESS 4.8.1) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.1) message(FATAL_ERROR "Vc 1.x requires C++11 support. This requires at least GCC 4.8.1") endif() else() - message(WARNING "Untested/-supported Compiler (${CMAKE_CXX_COMPILER}) for use with Vc.\nPlease fill out the missing parts in the CMake scripts and submit a patch to http://code.compeng.uni-frankfurt.de/projects/vc") + message(WARNING "Untested/-supported Compiler (${CMAKE_CXX_COMPILER}) for use with Vc.\nPlease fill out the missing parts in the CMake scripts and submit a patch to https://github.com/VcDevel/Vc") endif() endif() endmacro() @@ -207,7 +162,7 @@ int main() { return 0; } set(Vc_DEFINITIONS "${Vc_DEFINITIONS} -DVc_HAVE_LIBMVEC=1") endif() endif() - endif(Vc_LIB_MVEC) + endif() set(_add_warning_flags false) set(_add_buildtype_flags false) @@ -337,20 +292,11 @@ int main() { return 0; } vc_add_compiler_flag(Vc_COMPILE_FLAGS "/Gv") # default to __vectorcall vc_add_compiler_flag(Vc_COMPILE_FLAGS "/bigobj") # required for building tests with AVX - if(MSVC_VERSION LESS 1900) - UserWarning("MSVC before 2015 does not support enough of C++11") - endif() elseif(Vc_COMPILER_IS_CLANG) ################################################################################################## # Clang # ################################################################################################## - if(Vc_CLANG_VERSION VERSION_GREATER "3.5.99" AND Vc_CLANG_VERSION VERSION_LESS 3.7.0) - UserWarning("Clang 3.6 has serious issues with AVX code generation, frequently losing 50% of the data. AVX is therefore disabled.\nPlease update to a more recent clang version.\n") - set(Vc_AVX_INTRINSICS_BROKEN true) - set(Vc_AVX2_INTRINSICS_BROKEN true) - endif() - # disable these warnings because clang shows them for function overloads that were discarded via SFINAE vc_add_compiler_flag(Vc_COMPILE_FLAGS "-Wno-local-type-template-args") vc_add_compiler_flag(Vc_COMPILE_FLAGS "-Wno-unnamed-type-template-args") @@ -377,7 +323,7 @@ int main() { return 0; } endmacro() # helper macro for vc_compile_for_all_implementations -macro(_vc_compile_one_implementation _srcs _impl) +macro(_vc_compile_one_implementation _impl) list(FIND _disabled_targets "${_impl}" _disabled_index) list(FIND _only_targets "${_impl}" _only_index) if(${_disabled_index} GREATER -1) @@ -433,7 +379,7 @@ macro(_vc_compile_one_implementation _srcs _impl) COMPILE_DEFINITIONS "Vc_IMPL=${_impl}" COMPILE_FLAGS "${_flags} ${_extra_flags}" ) - list(APPEND ${_srcs} "${_out}") + target_sources(Vc PRIVATE "${_out}") endif() endif() endmacro() @@ -444,7 +390,7 @@ endmacro() # Example: # vc_compile_for_all_implementations(_objs src/trigonometric.cpp FLAGS -DCOMPILE_BLAH EXCLUDE Scalar) # add_executable(executable main.cpp ${_objs}) -macro(vc_compile_for_all_implementations _srcs _src) +macro(vc_compile_for_all_implementations _src) set(_flags) unset(_disabled_targets) unset(_only_targets) @@ -469,34 +415,34 @@ macro(vc_compile_for_all_implementations _srcs _src) set(_vc_compile_src "${_src}") - _vc_compile_one_implementation(${_srcs} Scalar NO_FLAG) + _vc_compile_one_implementation(Scalar NO_FLAG) if(NOT Vc_SSE_INTRINSICS_BROKEN) - _vc_compile_one_implementation(${_srcs} SSE2 "-xSSE2" "-msse2" "/arch:SSE2") - _vc_compile_one_implementation(${_srcs} SSE3 "-xSSE3" "-msse3" "/arch:SSE2") - _vc_compile_one_implementation(${_srcs} SSSE3 "-xSSSE3" "-mssse3" "/arch:SSE2") - _vc_compile_one_implementation(${_srcs} SSE4_1 "-xSSE4.1" "-msse4.1" "/arch:SSE2") - _vc_compile_one_implementation(${_srcs} SSE4_2 "-xSSE4.2" "-msse4.2" "/arch:SSE2") - _vc_compile_one_implementation(${_srcs} SSE3+SSE4a "-msse4a") + _vc_compile_one_implementation(SSE2 "-xSSE2" "-msse2" "/arch:SSE2") + _vc_compile_one_implementation(SSE3 "-xSSE3" "-msse3" "/arch:SSE2") + _vc_compile_one_implementation(SSSE3 "-xSSSE3" "-mssse3" "/arch:SSE2") + _vc_compile_one_implementation(SSE4_1 "-xSSE4.1" "-msse4.1" "/arch:SSE2") + _vc_compile_one_implementation(SSE4_2 "-xSSE4.2" "-msse4.2" "/arch:SSE2") + _vc_compile_one_implementation(SSE3+SSE4a "-msse4a") endif() if(NOT Vc_AVX_INTRINSICS_BROKEN) - _vc_compile_one_implementation(${_srcs} AVX "-xAVX" "-mavx" "/arch:AVX") + _vc_compile_one_implementation(AVX "-xAVX" "-mavx" "/arch:AVX") if(NOT Vc_XOP_INTRINSICS_BROKEN) if(NOT Vc_FMA4_INTRINSICS_BROKEN) - _vc_compile_one_implementation(${_srcs} SSE+XOP+FMA4 "-mxop -mfma4" "" "") - _vc_compile_one_implementation(${_srcs} AVX+XOP+FMA4 "-mavx -mxop -mfma4" "" "") + _vc_compile_one_implementation(SSE+XOP+FMA4 "-mxop -mfma4" "" "") + _vc_compile_one_implementation(AVX+XOP+FMA4 "-mavx -mxop -mfma4" "" "") endif() - _vc_compile_one_implementation(${_srcs} SSE+XOP+FMA "-mxop -mfma" "" "") - _vc_compile_one_implementation(${_srcs} AVX+XOP+FMA "-mavx -mxop -mfma" "" "") + _vc_compile_one_implementation(SSE+XOP+FMA "-mxop -mfma" "" "") + _vc_compile_one_implementation(AVX+XOP+FMA "-mavx -mxop -mfma" "" "") endif() - _vc_compile_one_implementation(${_srcs} AVX+FMA "-mavx -mfma" "" "") + _vc_compile_one_implementation(AVX+FMA "-mavx -mfma" "" "") endif() if(NOT Vc_AVX2_INTRINSICS_BROKEN) # The necessary list is not clear to me yet. At this point I'll only consider Intel CPUs, in # which case AVX2 implies the availability of FMA and BMI2 - #_vc_compile_one_implementation(${_srcs} AVX2 "-mavx2") - #_vc_compile_one_implementation(${_srcs} AVX2+BMI2 "-mavx2 -mbmi2") - _vc_compile_one_implementation(${_srcs} AVX2+FMA+BMI2 "-xCORE-AVX2" "-mavx2 -mfma -mbmi2" "/arch:AVX2") - #_vc_compile_one_implementation(${_srcs} AVX2+FMA "-mavx2 -mfma") + #_vc_compile_one_implementation(AVX2 "-mavx2") + #_vc_compile_one_implementation(AVX2+BMI2 "-mavx2 -mbmi2") + _vc_compile_one_implementation(AVX2+FMA+BMI2 "-xCORE-AVX2" "-mavx2 -mfma -mbmi2" "/arch:AVX2") + #_vc_compile_one_implementation(AVX2+FMA "-mavx2 -mfma") endif() list(LENGTH _only_targets _len) if(_len GREATER 0) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 64b7e7147..ac36be895 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -73,9 +73,8 @@ vc_set_first_flag_of(_sse4_1_flag "-xSSE4.1" "-msse4.1" "/arch:SSE2") vc_set_first_flag_of(_avx_flag "-xAVX" "-mavx" "/arch:AVX") vc_set_first_flag_of(_avx2_flag "-xCORE-AVX2" "-mavx2" "/arch:AVX2") macro(vc_add_run_target _target) - if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - # do nothing. This just clutters the solution explorer - else() + # avoid cluttering the solution explorer + if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio") add_custom_target(run_${_target} ${_target} -v DEPENDS ${_target}