@@ -5,14 +5,15 @@ set(CMAKE_CXX_STANDARD 17)
55set (CMAKE_CXX_STANDARD_REQUIRED ON )
66set (CMAKE_AUTOMOC ON )
77
8- # === CRITICAL FIX: Set runtime library consistently ===
8+ # === Runtime library: must match Qt6 which always uses DLL runtime ===
99if (MSVC )
10- cmake_policy (SET CMP0091 NEW ) # Enable runtime library selection
11- # Use static runtime for consistency with your protobuf/abseil
12- set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$< CONFIG : Debug >: Debug >" )
13-
14- # Fix exception handling and UTF-8 warnings
10+ cmake_policy (SET CMP0091 NEW )
11+ # /MD (release) or /MDd (debug) — DLL runtime, same as Qt6.
12+ # protobuf_MSVC_STATIC_RUNTIME=OFF ensures protobuf follows the same setting.
13+ set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$< CONFIG : Debug >: Debug >DLL" )
14+ set (protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "" FORCE )
1515 add_compile_options (/EHsc /utf-8 )
16+ # Remove /VERBOSE:LIB from link options (noisy, only needed for debugging)
1617endif ()
1718
1819find_package (Qt6 REQUIRED COMPONENTS Core Network Sql Concurrent )
@@ -24,16 +25,16 @@ file(MAKE_DIRECTORY "${PROTO_OUT}")
2425
2526add_custom_command (
2627 OUTPUT
27- "${PROTO_OUT} /score_messages .pb.cc"
28- "${PROTO_OUT} /score_messages .pb.h"
28+ "${PROTO_OUT} /shadnet .pb.cc"
29+ "${PROTO_OUT} /shadnet .pb.h"
2930 COMMAND $<TARGET_FILE :protoc >
3031 "--proto_path=${CMAKE_CURRENT_SOURCE_DIR} /src"
3132 "--cpp_out=${PROTO_OUT} "
32- "${CMAKE_CURRENT_SOURCE_DIR} /src/score_messages .proto"
33+ "${CMAKE_CURRENT_SOURCE_DIR} /src/shadnet .proto"
3334 DEPENDS
34- "${CMAKE_CURRENT_SOURCE_DIR} /src/score_messages .proto"
35+ "${CMAKE_CURRENT_SOURCE_DIR} /src/shadnet .proto"
3536 protoc
36- COMMENT "Generating score_messages protobuf sources"
37+ COMMENT "Generating shadnet protobuf sources"
3738 VERBATIM
3839)
3940
@@ -59,7 +60,7 @@ set(SOURCES
5960 src/score_files.h
6061 src/cmd_score.cpp
6162 src/proto_utils.h
62- "${PROTO_OUT} /score_messages .pb.cc"
63+ "${PROTO_OUT} /shadnet .pb.cc"
6364)
6465
6566add_executable (shadnet ${SOURCES} )
@@ -78,9 +79,6 @@ target_link_libraries(shadnet PRIVATE
7879 libprotobuf
7980)
8081
81- # Optional: Add this to see what runtime libraries are being used
82- if (MSVC )
83- target_link_options (shadnet PRIVATE /VERBOSE:LIB )
84- endif ()
82+
8583
8684install (TARGETS shadnet RUNTIME DESTINATION bin)
0 commit comments