From d8a673a578e399c572ea9aecbeec9ec119276d08 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 3 Sep 2023 15:17:23 +0200 Subject: [PATCH] cmake: Always provide at least one file to a target While this would normally work no questions asked in something like 'make', 'nmake' or similar, it is an impossible task in CMake without an empty file. So we'll just provide it with an empty file. --- CMakeLists.txt | 58 +++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c72b6e4..f059b987 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -831,7 +831,6 @@ feature_updater(ON) ################################################################################ set(PROJECT_DATA ) set(PROJECT_LIBRARIES ) -set(PROJECT_LIBRARIES_DELAYED ) set(PROJECT_INCLUDE_DIRS ) set(PROJECT_TEMPLATES ) set(PROJECT_PRIVATE_GENERATED ) @@ -1522,12 +1521,6 @@ endif() # Windows if(D_PLATFORM_WINDOWS) - list(APPEND PROJECT_PRIVATE_SOURCE - "source/windll.cpp" - ) - list(APPEND PROJECT_LIBRARIES - Delayimp.lib - ) # Disable/Enable a ton of things. list(APPEND PROJECT_DEFINITIONS # Microsoft Visual C++ @@ -1976,7 +1969,23 @@ target_include_directories(StreamFX PRIVATE "${PROJECT_BINARY_DIR}/generated" ) -if(D_PLATFORM_WINDOWS) # Windows Support +# Ensure there is at least one file. +if(D_PLATFORM_WINDOWS) + target_sources(StreamFX + PRIVATE + "source/windll.cpp" + ) +else() + target_sources(StreamFX + PRIVATE + "/dev/null" + ) +endif() + +if(D_PLATFORM_WINDOWS) + # Windows-exclusive + + # Version Resource set(PROJECT_PRODUCT_NAME "${PROJECT_FULL_NAME}") set(PROJECT_COMPANY_NAME "${PROJECT_AUTHORS}") set(PROJECT_COPYRIGHT "${PROJECT_AUTHORS} © ${PROJECT_COPYRIGHT_YEARS}") @@ -1992,30 +2001,9 @@ if(D_PLATFORM_WINDOWS) # Windows Support "templates/windows/version.rc.in" "${PROJECT_BINARY_DIR}/generated/version.rc" ) -endif() +elseif(D_PLATFORM_MAC) + # MacOS exclusive Changes -# Set file version -set_target_properties(StreamFX PROPERTIES - MACHO_COMPATIBILITY_VERSION ${_VERSION_MAJOR}.${_VERSION_MINOR} - MACHO_CURRENT_VERSION ${PROJECT_VERSION} - SOVERSION ${_VERSION_MAJOR}.${_VERSION_MINOR} - VERSION ${PROJECT_VERSION} -) - -# Windows exclusive changes -if(D_PLATFORM_WINDOWS) - foreach(DELAYLOAD ${PROJECT_LIBRARIES_DELAYED}) - get_target_property(_lf StreamFX LINK_FLAGS) - if(NOT _lf) - set(_lf "") - endif() - set_target_properties(StreamFX PROPERTIES LINK_FLAGS "${_lf} /DELAYLOAD:${DELAYLOAD}") - add_link_options("/DELAYLOAD:${DELAYLOAD}") - endforeach() -endif() - -# MacOS exclusive Changes -if(D_PLATFORM_MAC) set_target_properties(StreamFX PROPERTIES # No automatic code signing in XCode XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" @@ -2066,6 +2054,14 @@ if(D_PLATFORM_MAC) endif() endif() +# Set file version +set_target_properties(StreamFX PROPERTIES + MACHO_COMPATIBILITY_VERSION ${_VERSION_MAJOR}.${_VERSION_MINOR} + MACHO_CURRENT_VERSION ${PROJECT_VERSION} + SOVERSION ${_VERSION_MAJOR}.${_VERSION_MINOR} + VERSION ${PROJECT_VERSION} +) + ################################################################################ # Add Core ################################################################################