# HG changeset patch # User Sebastien Jodogne # Date 1688665213 -7200 # Node ID 035ebc5b227c8084f5ec45d0a30698481471f3a9 # Parent 0069769cab66193dc28d685f278dd4c598eddf57 disable DefineSourceBasenameForTarget for MSVC diff -r 0069769cab66 -r 035ebc5b227c OrthancFramework/Resources/CMake/Compiler.cmake --- a/OrthancFramework/Resources/CMake/Compiler.cmake Thu Jul 06 17:04:42 2023 +0200 +++ b/OrthancFramework/Resources/CMake/Compiler.cmake Thu Jul 06 19:40:13 2023 +0200 @@ -271,11 +271,16 @@ # https://stackoverflow.com/questions/8487986/file-macro-shows-full-path # https://twitter.com/wget42/status/1676877802375634944?s=20 function(DefineSourceBasenameForTarget targetname) - get_target_property(source_files "${targetname}" SOURCES) - foreach(sourcefile ${source_files}) - get_filename_component(basename "${sourcefile}" NAME) - set_property( - SOURCE "${sourcefile}" APPEND - PROPERTY COMPILE_DEFINITIONS "__ORTHANC_FILE__=\"${basename}\"") - endforeach() + # Microsoft Visual Studio is extremely slow if using + # "set_property()", we only enable this feature for gcc and clang + if (CMAKE_COMPILER_IS_GNUCXX OR + CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + get_target_property(source_files "${targetname}" SOURCES) + foreach(sourcefile ${source_files}) + get_filename_component(basename "${sourcefile}" NAME) + set_property( + SOURCE "${sourcefile}" APPEND + PROPERTY COMPILE_DEFINITIONS "__ORTHANC_FILE__=\"${basename}\"") + endforeach() + endif() endfunction()