Mercurial > hg > orthanc
comparison OrthancFramework/Resources/CMake/Compiler.cmake @ 5359:035ebc5b227c
disable DefineSourceBasenameForTarget for MSVC
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Jul 2023 19:40:13 +0200 |
parents | fddb5d8d0021 |
children | 2948c694352e |
comparison
equal
deleted
inserted
replaced
5358:0069769cab66 | 5359:035ebc5b227c |
---|---|
269 # macro "__FILE__", as the latter leaks the full path of the source | 269 # macro "__FILE__", as the latter leaks the full path of the source |
270 # files in the binaries | 270 # files in the binaries |
271 # https://stackoverflow.com/questions/8487986/file-macro-shows-full-path | 271 # https://stackoverflow.com/questions/8487986/file-macro-shows-full-path |
272 # https://twitter.com/wget42/status/1676877802375634944?s=20 | 272 # https://twitter.com/wget42/status/1676877802375634944?s=20 |
273 function(DefineSourceBasenameForTarget targetname) | 273 function(DefineSourceBasenameForTarget targetname) |
274 get_target_property(source_files "${targetname}" SOURCES) | 274 # Microsoft Visual Studio is extremely slow if using |
275 foreach(sourcefile ${source_files}) | 275 # "set_property()", we only enable this feature for gcc and clang |
276 get_filename_component(basename "${sourcefile}" NAME) | 276 if (CMAKE_COMPILER_IS_GNUCXX OR |
277 set_property( | 277 CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
278 SOURCE "${sourcefile}" APPEND | 278 get_target_property(source_files "${targetname}" SOURCES) |
279 PROPERTY COMPILE_DEFINITIONS "__ORTHANC_FILE__=\"${basename}\"") | 279 foreach(sourcefile ${source_files}) |
280 endforeach() | 280 get_filename_component(basename "${sourcefile}" NAME) |
281 set_property( | |
282 SOURCE "${sourcefile}" APPEND | |
283 PROPERTY COMPILE_DEFINITIONS "__ORTHANC_FILE__=\"${basename}\"") | |
284 endforeach() | |
285 endif() | |
281 endfunction() | 286 endfunction() |