From 9f600f4b47704c18990561b90a2ac122ced2c53c Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 31 Dec 2024 19:15:30 +0100 Subject: [PATCH] Dissolve msh3_headers, cleanup --- CMakeLists.txt | 16 +++------------- lib/CMakeLists.txt | 12 ++++++++++-- test/CMakeLists.txt | 2 +- tool/CMakeLists.txt | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 640da375..f8b69b27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,20 +39,16 @@ if (WIN32) # Statically link the OS included part of the runtime. set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - set(QUIC_COMMON_DEFINES WIN32_LEAN_AND_MEAN SECURITY_WIN32) - # TODO - Get these to work on Linux - list(APPEND MSH3_COMMON_DEFINES VER_BUILD_ID=${MSH3_VER_BUILD_ID}) - list(APPEND MSH3_COMMON_DEFINES VER_SUFFIX=${MSH3_VER_SUFFIX}) + + add_compile_definitions(WIN32_LEAN_AND_MEAN) if(HAS_SPECTRE) - list(APPEND QUIC_COMMON_FLAGS /Qspectre) + add_compile_options(/Qspectre) endif() # Compile/link flags set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL /Zi") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /Zi") set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /IGNORE:4075 /DEBUG /OPT:REF /OPT:ICF") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /IGNORE:4075 /DEBUG /OPT:REF /OPT:ICF") -else() - set(QUIC_COMMON_DEFINES _GNU_SOURCE) endif() set(MSH3_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE STRING "Output directory for build artifacts") @@ -65,12 +61,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${MSH3_OUTPUT_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${MSH3_OUTPUT_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${MSH3_OUTPUT_DIR}) -# Public include header. -add_library(msh3_headers INTERFACE) -target_compile_features(msh3_headers INTERFACE cxx_std_20) -target_compile_definitions(msh3_headers INTERFACE ${MSH3_COMMON_DEFINES}) -target_include_directories(msh3_headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) - # ls-qpack dependency option(MSH3_USE_EXTERNAL_LSQPACK "Use an external ls-qpack installation") if(MSH3_USE_EXTERNAL_LSQPACK) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index ade49474..1b2a33dd 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -7,8 +7,16 @@ else() set(SOURCES msh3.cpp) endif() add_library(msh3 SHARED ${SOURCES}) -target_include_directories(msh3 PUBLIC $) -target_link_libraries(msh3 PRIVATE msquic msquic_platform ls-qpack::ls-qpack msh3_headers) +target_compile_features(msh3 PRIVATE cxx_std_20) +target_compile_definitions(msh3 PRIVATE + "VER_BUILD_ID=${MSH3_VER_BUILD_ID}" + "VER_SUFFIX=${MSH3_VER_SUFFIX}" +) +target_include_directories(msh3 PUBLIC + $ + $ +) +target_link_libraries(msh3 PRIVATE msquic msquic_platform ls-qpack::ls-qpack) if (NOT BUILD_SHARED_LIBS) target_link_libraries(msh3 PRIVATE base_link) endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 639f4eba..9cd4d6c4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,5 +3,5 @@ set(SOURCES msh3test.cpp) add_executable(msh3test ${SOURCES}) -target_link_libraries(msh3test msh3 msh3_headers) +target_link_libraries(msh3test msh3) install(TARGETS msh3test EXPORT msh3 RUNTIME DESTINATION bin) diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index 92313615..c4b08442 100644 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -3,5 +3,5 @@ set(SOURCES msh3_app.cpp) add_executable(msh3app ${SOURCES}) -target_link_libraries(msh3app msh3 msh3_headers) +target_link_libraries(msh3app msh3) install(TARGETS msh3app EXPORT msh3 RUNTIME DESTINATION bin)