SSX3LobbyServer/cmake/ProjectFuncs.cmake

25 lines
1.0 KiB
CMake

function(lobbyserver_target target)
target_compile_definitions(${target} PRIVATE "$<$<CONFIG:DEBUG>:LOBBYSERVER_DEBUG>")
#target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR})
target_compile_features(${target} PRIVATE cxx_std_20)
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/lib ${CMAKE_CURRENT_BINARY_DIR})
endfunction()
function(lobbyserver_set_alternate_linker)
find_program(LINKER_EXECUTABLE ld.${LOBBYSERVER_LINKER} ${HOLGOL_LINKER})
if(LINKER_EXECUTABLE)
message(STATUS "Using ${LOBBYSERVER_LINKER} as linker")
else()
message(FATAL_ERROR "Linker ${LOBBYSERVER_LINKER} does not exist on your system. Please specify one which does or omit this option from your configure command.")
endif()
endfunction()
# Set a default linker if the user never provided one.
# This defaults based on the detected compiler to the "best" linker possible
if(NOT LOBBYSERVER_LINKER AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(LOBBYSERVER_LINKER "lld")
elseif(NOT LOBBYSERVER_LINKER)
set(LOBBYSERVER_LINKER "bfd")
endif()