slight restructure of CMakeLists

This commit is contained in:
veclav talica 2024-08-20 17:50:50 +03:00
parent 2126f3cddb
commit 08fd5970a1
3 changed files with 8 additions and 6 deletions

View File

@ -187,7 +187,9 @@ function(link_and_include_deps target)
endfunction() endfunction()
function(use_townengine target) function(use_townengine target sources)
add_executable(${target} ${sources})
# system libraries # system libraries
find_library(MATH_LIBRARY m) find_library(MATH_LIBRARY m)
if(MATH_LIBRARY) if(MATH_LIBRARY)
@ -219,7 +221,9 @@ endfunction()
give_options(${TOWNENGINE_TARGET}) give_options(${TOWNENGINE_TARGET})
link_and_include_deps(${TOWNENGINE_TARGET}) link_and_include_deps(${TOWNENGINE_TARGET})
add_subdirectory(apps/testgame) if (${CMAKE_PROJECT_NAME} MATCHES townengine)
add_subdirectory(apps/testgame)
endif ()
# zip up assets # zip up assets
# currently, you must run cmake from the project root dir for this to work correctly # currently, you must run cmake from the project root dir for this to work correctly

View File

@ -15,8 +15,7 @@ set(SOURCE_FILES
game.c game.c
) )
add_executable(${PROJECT_NAME} ${SOURCE_FILES}) use_townengine(${PROJECT_NAME} "${SOURCE_FILES}")
use_townengine(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}

View File

@ -23,8 +23,7 @@ set(SOURCE_FILES
scenes/ingame.c scenes/ingame.h scenes/ingame.c scenes/ingame.h
) )
add_executable(${PROJECT_NAME} ${SOURCE_FILES}) use_townengine(${PROJECT_NAME} "${SOURCE_FILES}")
use_townengine(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}