Mercurial > hg > orthanc
comparison OrthancServer/CMakeLists.txt @ 5260:dd9443ac2dbf
trying to fully disable precompiled headers for visual studio
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 12 Apr 2023 14:32:59 +0200 |
parents | 0d1704d8cc65 |
children | bf304ee8dd80 |
comparison
equal
deleted
inserted
replaced
5259:0d1704d8cc65 | 5260:dd9443ac2dbf |
---|---|
72 if (ENABLE_PLUGINS) | 72 if (ENABLE_PLUGINS) |
73 set(ENABLE_PROTOBUF ON) | 73 set(ENABLE_PROTOBUF ON) |
74 set(ENABLE_PROTOBUF_COMPILER ON) | 74 set(ENABLE_PROTOBUF_COMPILER ON) |
75 endif() | 75 endif() |
76 | 76 |
77 include(${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/CMake/VisualStudioPrecompiledHeaders.cmake) | |
78 include(${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake) | 77 include(${CMAKE_SOURCE_DIR}/../OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake) |
79 | 78 |
80 # To export the proper symbols in the sample plugins | 79 # To export the proper symbols in the sample plugins |
81 include(${CMAKE_SOURCE_DIR}/Plugins/Samples/Common/OrthancPluginsExports.cmake) | 80 include(${CMAKE_SOURCE_DIR}/Plugins/Samples/Common/OrthancPluginsExports.cmake) |
82 | 81 |
329 # Macros for the plugins | 328 # Macros for the plugins |
330 -DHAS_ORTHANC_EXCEPTION=0 | 329 -DHAS_ORTHANC_EXCEPTION=0 |
331 ) | 330 ) |
332 | 331 |
333 | 332 |
334 # Setup precompiled headers for Microsoft Visual Studio | |
335 | |
336 # WARNING: There must be NO MORE "add_definitions()", "include()" or | |
337 # "include_directories()" below, otherwise the generated precompiled | |
338 # headers might get broken! | |
339 | |
340 if (MSVC) | |
341 set(TMP | |
342 ${ORTHANC_CORE_SOURCES_INTERNAL} | |
343 ${ORTHANC_DICOM_SOURCES_INTERNAL} | |
344 ) | |
345 | |
346 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
347 "PrecompiledHeaders.h" "${CMAKE_SOURCE_DIR}/../OrthancFramework/Sources/PrecompiledHeaders.cpp" | |
348 TMP ORTHANC_CORE_PCH) | |
349 | |
350 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
351 "PrecompiledHeadersServer.h" "${CMAKE_SOURCE_DIR}/Sources/PrecompiledHeadersServer.cpp" | |
352 ORTHANC_SERVER_SOURCES ORTHANC_SERVER_PCH) | |
353 | |
354 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
355 "PrecompiledHeadersUnitTests.h" "${CMAKE_SOURCE_DIR}/UnitTestsSources/PrecompiledHeadersUnitTests.cpp" | |
356 ORTHANC_SERVER_UNIT_TESTS ORTHANC_UNIT_TESTS_PCH) | |
357 endif() | |
358 | |
359 | |
360 | |
361 ##################################################################### | 333 ##################################################################### |
362 ## Build the core of Orthanc | 334 ## Build the core of Orthanc |
363 ##################################################################### | 335 ##################################################################### |
364 | 336 |
365 add_custom_target(AutogeneratedTarget | 337 add_custom_target(AutogeneratedTarget |
369 | 341 |
370 # "CoreLibrary" contains all the third-party dependencies and the | 342 # "CoreLibrary" contains all the third-party dependencies and the |
371 # content of the "OrthancFramework" folder | 343 # content of the "OrthancFramework" folder |
372 add_library(CoreLibrary | 344 add_library(CoreLibrary |
373 STATIC | 345 STATIC |
374 ${ORTHANC_CORE_PCH} | |
375 ${ORTHANC_CORE_SOURCES} | 346 ${ORTHANC_CORE_SOURCES} |
376 ${ORTHANC_DICOM_SOURCES} | 347 ${ORTHANC_DICOM_SOURCES} |
377 ${AUTOGENERATED_SOURCES} | 348 ${AUTOGENERATED_SOURCES} |
378 ) | 349 ) |
379 | |
380 if (MSVC) | |
381 set_target_properties( | |
382 CoreLibrary | |
383 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1" | |
384 ) | |
385 endif() | |
386 | 350 |
387 add_dependencies(CoreLibrary AutogeneratedTarget) | 351 add_dependencies(CoreLibrary AutogeneratedTarget) |
388 | 352 |
389 if (LIBICU_LIBRARIES) | 353 if (LIBICU_LIBRARIES) |
390 target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES}) | 354 target_link_libraries(CoreLibrary ${LIBICU_LIBRARIES}) |
419 add_custom_target(OrthancDatabaseProtobuf) | 383 add_custom_target(OrthancDatabaseProtobuf) |
420 endif() | 384 endif() |
421 | 385 |
422 add_library(ServerLibrary | 386 add_library(ServerLibrary |
423 STATIC | 387 STATIC |
424 ${ORTHANC_SERVER_PCH} | |
425 ${ORTHANC_SERVER_SOURCES} | 388 ${ORTHANC_SERVER_SOURCES} |
426 ) | 389 ) |
427 | |
428 if (MSVC) | |
429 set_target_properties( | |
430 ServerLibrary | |
431 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1" | |
432 ) | |
433 endif() | |
434 | 390 |
435 # Ensure autogenerated code is built before building ServerLibrary | 391 # Ensure autogenerated code is built before building ServerLibrary |
436 add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf) | 392 add_dependencies(ServerLibrary CoreLibrary OrthancDatabaseProtobuf) |
437 | 393 |
438 add_executable(Orthanc | 394 add_executable(Orthanc |
462 ## Build the unit tests | 418 ## Build the unit tests |
463 ##################################################################### | 419 ##################################################################### |
464 | 420 |
465 add_executable(UnitTests | 421 add_executable(UnitTests |
466 ${GOOGLE_TEST_SOURCES} | 422 ${GOOGLE_TEST_SOURCES} |
467 ${ORTHANC_UNIT_TESTS_PCH} | |
468 ${ORTHANC_FRAMEWORK_UNIT_TESTS} | 423 ${ORTHANC_FRAMEWORK_UNIT_TESTS} |
469 ${ORTHANC_SERVER_UNIT_TESTS} | 424 ${ORTHANC_SERVER_UNIT_TESTS} |
470 ${BOOST_EXTENDED_SOURCES} | 425 ${BOOST_EXTENDED_SOURCES} |
471 ) | 426 ) |
472 | |
473 if (MSVC) | |
474 set_target_properties( | |
475 UnitTests | |
476 PROPERTIES COMPILE_DEFINITIONS "ORTHANC_USE_PRECOMPILED_HEADERS=1" | |
477 ) | |
478 endif() | |
479 | 427 |
480 target_link_libraries(UnitTests | 428 target_link_libraries(UnitTests |
481 ServerLibrary | 429 ServerLibrary |
482 CoreLibrary | 430 CoreLibrary |
483 ${DCMTK_LIBRARIES} | 431 ${DCMTK_LIBRARIES} |