From 74a3cbdc454c5a5342c7d243c9750aacade5df0b Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Sun, 21 Nov 2021 17:15:00 +0800 Subject: [PATCH] Fix CMake Make the paths generic. --- CMakeLists.txt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70e3c05..de7fdd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,23 +3,24 @@ project(izanami C) set(CMAKE_C_STANDARD 11) -set(SDL2PATH "E:\\Projects\\Games\\izanami\\dependencies\\SDL2-2.0.16\\x86_64-w64-mingw32") +set(SDL2PATH "${PROJECT_SOURCE_DIR}/dependencies/SDL2-2.0.16/x86_64-w64-mingw32") find_package(SDL2 REQUIRED) include_directories(${SDL2_INCLUDE_DIR}) + add_executable(izanami src/packages/game/main.c src/packages/game/math/IZ_vector.c src/packages/game/math/IZ_vector.h src/packages/game/math/IZ_math.c src/packages/game/math/IZ_math.h src/packages/game/core/IZ_placeable.c src/packages/game/core/IZ_placeable.h src/packages/game/core/IZ_movable.c src/packages/game/core/IZ_movable.h src/packages/game/core/IZ_spatial.c src/packages/game/core/IZ_spatial.h) -target_link_libraries(izanami ${SDL2_LIBRARY}) +target_link_libraries(izanami ${SDL2_LIBRARY}) if (WIN32) -add_custom_command(TARGET izanami POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${PROJECT_SOURCE_DIR}/dependencies/SDL2-2.0.16/x86_64-w64-mingw32/bin/SDL2.dll" # <--this is in-file - $) # <--this is out-file path + add_custom_command(TARGET izanami POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${PROJECT_SOURCE_DIR}/dependencies/SDL2-2.0.16/x86_64-w64-mingw32/bin/SDL2.dll" + $) endif (WIN32) if (WIN64) add_custom_command(TARGET izanami POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake - E copy_if_different..." - "${PROJECT_SOURCE_DIR}/dependencies/SDL2-2.0.16/x86_64-w64-mingw32/bin/SDL2.dll" # <--this is in-file - $) # <--this is out-file path + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${PROJECT_SOURCE_DIR}/dependencies/SDL2-2.0.16/x86_64-w64-mingw32/bin/SDL2.dll" + $) endif (WIN64)