dmtools/cmake/ProjectFuncs.cmake

25 lines
1.0 KiB
CMake
Raw Normal View History

function(dmtools_target target)
target_compile_definitions(${target} PRIVATE "$<$<CONFIG:DEBUG>:DMTOOLS_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(dmtools_set_alternate_linker)
find_program(LINKER_EXECUTABLE ld.${DMTOOLS_LINKER} ${COLLABVM_LINKER})
if(LINKER_EXECUTABLE)
message(STATUS "Using ${DMTOOLS_LINKER} as linker")
else()
message(FATAL_ERROR "Linker ${DMTOOLS_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 DMTOOLS_LINKER AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(DMTOOLS_LINKER "lld")
elseif(NOT DMTOOLS_LINKER)
set(DMTOOLS_LINKER "bfd")
endif()