CMAKE: fixed DEBUGGER_COMMAND handling

master
Martin Gerhardy 2018-06-26 17:33:30 +02:00
parent 3dd3540a66
commit 74cdefe2ee
3 changed files with 18 additions and 13 deletions

View File

@ -34,13 +34,6 @@ set_property(CACHE DEBUGGER PROPERTY STRINGS gdb lldb)
set(SERVER_HOST "localhost" CACHE STRING "Host where the server is running on")
set(SERVER_PORT "11337" CACHE STRING "Port where the server is listening on")
set(BASE_URL "http://localhost/" CACHE STRING "Base url of the http endpoints")
if (${DEBUGGER} STREQUAL "gdb")
set(DEBUGGER_COMMAND "${GDB_EXECUTABLE} -ex run --args" CACHE STRING "The gdb command line to debug and run an executable")
elseif (${DEBUGGER} STREQUAL "lldb")
set(DEBUGGER_COMMAND "${LLDB_EXECUTABLE} -b -o run" CACHE STRING "The lldb command line to debug and run an executable")
else()
message(WARN "Unknown DEBUGGER value - set to gdb or lldb")
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(WINDOWS 1)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Android")

View File

@ -471,12 +471,23 @@ endmacro()
macro(engine_add_debuggger TARGET)
add_custom_target(${TARGET}-debug)
add_custom_command(TARGET ${TARGET}-debug
COMMAND ${DEBUGGER_COMMAND} $<TARGET_FILE:${TARGET}>
COMMENT "Starting debugger session for ${TARGET}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${TARGET}
DEPENDS ${TARGET}
)
if (${DEBUGGER} STREQUAL "gdb")
add_custom_command(TARGET ${TARGET}-debug
COMMAND ${GDB_EXECUTABLE} -ex run --args $<TARGET_FILE:${TARGET}>
COMMENT "Starting debugger session for ${TARGET}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${TARGET}
DEPENDS ${TARGET}
)
elseif (${DEBUGGER} STREQUAL "lldb")
add_custom_command(TARGET ${TARGET}-debug
COMMAND ${LLDB_EXECUTABLE} -b -o run $<TARGET_FILE:${TARGET}>
COMMENT "Starting debugger session for ${TARGET}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${TARGET}
DEPENDS ${TARGET}
)
else()
message(WARN "Unknown DEBUGGER value - set to gdb or lldb")
endif()
endmacro()
#-------------------------------------------------------------------------------

View File

@ -124,5 +124,6 @@ gtest_suite_deps(tests ${LIB})
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
gtest_suite_files(tests-${LIB} tests/testluaregistry.lua)
gtest_suite_deps(tests-${LIB} ${LIB})
gtest_suite_end(tests-${LIB})