Windows/VS: Fix Build with VS2019 integrated CMake, set startup project

Apparently VS2019 (or its integrated CMake?) interpreted
add_definitions(/MP) as "also pass it to rc.exe" which didn't like it..
no idea why this worked before, but now it seems to work everywhere.
fix #304

Also set VS_STARTUP_PROJECT so when launching the debugger in VS it doesn't
try to launch ALL_BUILD (...) but dhewm3.
This commit is contained in:
Daniel Gibson 2020-08-02 04:41:45 +02:00
parent 7d2bda07a3
commit 8b66bad68f

View file

@ -262,7 +262,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(sys_libs ${sys_libs} ${EXECINFO_LIBRARIES})
endif()
elseif(MSVC)
add_definitions(/MP) # parallel build (use all cores, or as many as configured in VS)
add_compile_options(/MP) # parallel build (use all cores, or as many as configured in VS)
add_compile_options(/W4)
add_compile_options(/we4840) # treat as error when passing a class to a vararg-function (probably printf-like)
@ -961,6 +961,11 @@ if(CORE)
${src_sys_core}
${src_editor_tools}
)
if(MSVC AND CMAKE_MAJOR_VERSION GREATER 3 OR ( CMAKE_MAJOR_VERSION EQUAL 3 AND CMAKE_MINOR_VERSION GREATER_EQUAL 6 ))
# CMake >= 3.6 supports setting the default project started for debugging (instead of trying to launch ALL_BUILD ...)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${DHEWM3BINARY})
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX neo FILES ${src_core} ${src_sys_base} ${src_sys_core} ${src_editor_tools})