Skip to content

Commit

Permalink
Use CMAKE_CURRENT_SOURCE_DIR where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
alef committed Jan 28, 2024
1 parent ab3866d commit 1503593
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_subdirectory(${CMAKE_SOURCE_DIR}/src/third-party)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party)

set(MAIN_CPP ${CMAKE_SOURCE_DIR}/src/main.cpp)
set(MESSAGES_CPP ${CMAKE_SOURCE_DIR}/src/messages.cpp)
set(RESOURCE_RC ${CMAKE_SOURCE_DIR}/src/resource.rc)
set(MAIN_CPP ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
set(MESSAGES_CPP ${CMAKE_CURRENT_SOURCE_DIR}/messages.cpp)
set(RESOURCE_RC ${CMAKE_CURRENT_SOURCE_DIR}/resource.rc)

if (WIN32)
set(RSRC_RC_DEP "${CMAKE_SOURCE_DIR}/data/cataicon.ico")
Expand All @@ -13,16 +13,16 @@ if (WIN32)
OBJECT_DEPENDS "${RSRC_RC_DEP}")
endif ()

file(GLOB CATACLYSM_DDA_SOURCES ${CMAKE_SOURCE_DIR}/src/*.cpp)
file(GLOB CATACLYSM_DDA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

list(REMOVE_ITEM CATACLYSM_DDA_SOURCES ${MAIN_CPP} ${MESSAGES_CPP})

file(GLOB CATACLYSM_DDA_HEADERS ${CMAKE_SOURCE_DIR}/src/*.h)
file(GLOB CATACLYSM_DDA_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)

# Get GIT version strings
add_custom_target(
get_version
DEPENDS ${CMAKE_SOURCE_DIR}/src/version.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

add_custom_command(
Expand All @@ -36,7 +36,7 @@ if (TILES)
cataclysm-tiles-common OBJECT
${CATACLYSM_DDA_SOURCES}
${CATACLYSM_DDA_HEADERS})
target_include_directories(cataclysm-tiles-common INTERFACE ${CMAKE_SOURCE_DIR}/src)
target_include_directories(cataclysm-tiles-common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(cataclysm-tiles-common PUBLIC third-party)

Expand Down Expand Up @@ -150,7 +150,7 @@ if (CURSES)
add_library(cataclysm-common OBJECT
${CATACLYSM_DDA_SOURCES}
${CATACLYSM_DDA_HEADERS})
target_include_directories(cataclysm-common INTERFACE ${CMAKE_SOURCE_DIR}/src)
target_include_directories(cataclysm-common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(cataclysm-common PUBLIC third-party)

Expand Down

0 comments on commit 1503593

Please sign in to comment.