CMakeFiles.txt: no target_app

This commit is contained in:
veclav talica 2024-10-08 00:50:25 +03:00
parent f1e2fa090b
commit 03c451fba8

View File

@ -255,7 +255,7 @@ function(use_townengine target sources output_directory)
RUNTIME_OUTPUT_DIRECTORY ${output_directory})
# launcher binary, loads game and engine shared library
add_executable(${target}_app ${TWN_ROOT_DIR}/src/twn_main.c)
add_executable(${target} ${TWN_ROOT_DIR}/src/twn_main.c)
# todo: copy instead?
# put libtownengine.so alongside the binary
@ -263,38 +263,36 @@ function(use_townengine target sources output_directory)
LIBRARY_OUTPUT_DIRECTORY ${output_directory})
else()
# build and link all statically
add_executable(${target}_app ${sources})
add_executable(${target} ${sources})
endif()
set_target_properties(${target}_app PROPERTIES
OUTPUT_NAME ${target}
set_target_properties(${target} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${output_directory}
RUNTIME_OUTPUT_DIRECTORY ${output_directory})
if(EMSCRIPTEN)
set_target_properties(${target}_app PROPERTIES
SUFFIX .html)
set_target_properties(${target} PROPERTIES SUFFIX .html)
endif()
target_compile_options(${target}_app PRIVATE
target_compile_options(${target} PRIVATE
$<$<BOOL:${EMSCRIPTEN}>:--shell-file ${TWN_ROOT_DIR}/shell_minimal.html>)
# system libraries
find_library(MATH_LIBRARY m)
if (MATH_LIBRARY)
target_link_libraries(${target}_app PUBLIC ${MATH_LIBRARY})
target_link_libraries(${target} PUBLIC ${MATH_LIBRARY})
endif()
give_options(${target}_app)
include_deps(${target}_app)
link_deps(${target}_app)
give_options(${target})
include_deps(${target})
link_deps(${target})
target_link_libraries(${target}_app PUBLIC ${TWN_TARGET})
target_link_libraries(${target} PUBLIC ${TWN_TARGET})
if(WIN32)
# copy dlls for baby windows
add_custom_command(TARGET ${target}_app POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_RUNTIME_DLLS:${target}_app>
$<TARGET_FILE_DIR:${target}_app>
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_RUNTIME_DLLS:${target}>
$<TARGET_FILE_DIR:${target}>
COMMAND_EXPAND_LISTS)
endif()
endfunction()