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