comparison Resources/CMake/Compiler.cmake @ 3278:ce6a98f8ed85

New CMake option: "-DMSVC_MULTIPLE_PROCESSES=ON" for parallel build with Visual Studio
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 21 Feb 2019 12:05:48 +0100
parents fcfd4f73228c
children cbbe0bb80bd4
comparison
equal deleted inserted replaced
3277:7d4e06beb1ec 3278:ce6a98f8ed85
37 endforeach(flag_var) 37 endforeach(flag_var)
38 38
39 # Add /Zm256 compiler option to Visual Studio to fix PCH errors 39 # Add /Zm256 compiler option to Visual Studio to fix PCH errors
40 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm256") 40 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm256")
41 41
42 # New in Orthanc 1.5.5
43 if (MSVC_MULTIPLE_PROCESSES)
44 # "If you omit the processMax argument in the /MP option, the
45 # compiler obtains the number of effective processors from the
46 # operating system, and then creates one process per effective
47 # processor"
48 # https://blog.kitware.com/cmake-building-with-all-your-cores/
49 # https://docs.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes
50 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
51 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
52 endif()
53
42 add_definitions( 54 add_definitions(
43 -D_CRT_SECURE_NO_WARNINGS=1 55 -D_CRT_SECURE_NO_WARNINGS=1
44 -D_CRT_SECURE_NO_DEPRECATE=1 56 -D_CRT_SECURE_NO_DEPRECATE=1
45 ) 57 )
46 58