CMake: Use openttd_lib split build from upstream

Add option to disable for cross-compiling
This commit is contained in:
Jonathan G Rennison
2023-12-13 17:26:37 +00:00
parent c466292d8a
commit 15ed39b5ac
4 changed files with 39 additions and 18 deletions

View File

@@ -83,5 +83,5 @@ else()
endif()
if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB)
target_link_libraries(openttd atomic)
target_link_libraries(${OPENTTD_LIB} atomic)
endif()

View File

@@ -8,13 +8,13 @@ function(link_package NAME)
# which (later) cmake considers to be an error. Work around this with by stripping the incoming string.
if(LP_TARGET AND TARGET ${LP_TARGET})
string(STRIP "${LP_TARGET}" LP_TARGET)
target_link_libraries(openttd ${LP_TARGET})
target_link_libraries(${OPENTTD_LIB} ${LP_TARGET})
message(STATUS "${NAME} found -- -DWITH_${UCNAME} -- ${LP_TARGET}")
else()
string(STRIP "${${NAME}_LIBRARY}" ${NAME}_LIBRARY)
string(STRIP "${${NAME}_LIBRARIES}" ${NAME}_LIBRARIES)
include_directories(${${NAME}_INCLUDE_DIRS} ${${NAME}_INCLUDE_DIR})
target_link_libraries(openttd ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY})
target_link_libraries(${OPENTTD_LIB} ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY})
message(STATUS "${NAME} found -- -DWITH_${UCNAME} -- ${${NAME}_INCLUDE_DIRS} ${${NAME}_INCLUDE_DIR} -- ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY}")
endif()
elseif(LP_ENCOURAGED)

View File

@@ -32,7 +32,7 @@ endfunction()
# For example: ADD_IF SDL_FOUND AND Allegro_FOUND
#
function(add_files)
_add_files_tgt(openttd ${ARGV})
_add_files_tgt(${OPENTTD_LIB} ${ARGV})
endfunction()
# Add a test file to be compiled.
@@ -44,7 +44,9 @@ endfunction()
# For example: ADD_IF SDL_FOUND AND Allegro_FOUND
#
function(add_test_files)
_add_files_tgt(openttd_test ${ARGV})
if(NOT OPTION_NO_SPLIT_LIB)
_add_files_tgt(openttd_test ${ARGV})
endif()
endfunction()
# This function works around an 'issue' with CMake, where