From 852c17f04a4cf40950cc638870f633c2449da56e Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Fri, 11 Nov 2022 20:00:46 -0500 Subject: [PATCH] Update CMake rules for SpecProject for Windows compatibility. --- SpecProject/CMakeLists.txt | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/SpecProject/CMakeLists.txt b/SpecProject/CMakeLists.txt index a2e1374..1f8b6d1 100644 --- a/SpecProject/CMakeLists.txt +++ b/SpecProject/CMakeLists.txt @@ -12,9 +12,10 @@ endif() project(SpecProject) set(SPECPROJECT_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../bin) +set(SPECTER_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../lib/cmake) -#Use this to find Specter and its libraries. Specify the path to the Specter/lib dir after the PATHS keyword -find_package(Specter REQUIRED PATHS ../lib) +#Use this to find Specter and its libraries. Specify the path to the Specter/lib & Specter/lib/cmake dir after the PATHS keyword (handles windows/linux usecases) +find_package(Specter REQUIRED PATHS ../lib ../lib/cmake) add_executable(SpecProject) @@ -37,9 +38,17 @@ target_link_libraries(SpecProject PRIVATE Specter::Specter) set_target_properties(SpecProject PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SPECPROJECT_BINARY_DIR}) if(NOT EXISTS "${SPECPROJECT_BINARY_DIR}/Assets") - add_custom_command(TARGET SpecProject - POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink - ${CMAKE_CURRENT_SOURCE_DIR}/Assets - ${SPECPROJECT_BINARY_DIR}/Assets - ) + if(MSVC) + add_custom_command(TARGET SpecProject + POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/Assets + ${SPECPROJECT_BINARY_DIR}/Assets + ) + else() + add_custom_command(TARGET SpecProject + POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink + ${CMAKE_CURRENT_SOURCE_DIR}/Assets + ${SPECPROJECT_BINARY_DIR}/Assets + ) + endif() endif()