mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
18 lines
711 B
CMake
18 lines
711 B
CMake
|
|
||
|
include("${CMAKE_CURRENT_LIST_DIR}/FindCxxTest.cmake")
|
||
|
|
||
|
function(cxx_test target source)
|
||
|
get_filename_component(CPP_FILE_NAME ${source} NAME)
|
||
|
string(REGEX REPLACE "h$|hpp$" "cpp" CPP_FILE_NAME ${CPP_FILE_NAME})
|
||
|
message(${CPP_FILE_NAME})
|
||
|
set(CPP_FULL_NAME "${CMAKE_CURRENT_BINARY_DIR}/${CPP_FILE_NAME}")
|
||
|
add_custom_command(
|
||
|
OUTPUT "${CPP_FULL_NAME}"
|
||
|
COMMAND ${CXXTESTGEN} --runner=ErrorPrinter --output "${CPP_FULL_NAME}" "${source}"
|
||
|
DEPENDS "${source}"
|
||
|
)
|
||
|
add_executable(${target} ${CPP_FULL_NAME})
|
||
|
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "-Wno-effc++")
|
||
|
add_test(${target} ${RUNTIME_OUTPUT_DIRECTORY}/${target})
|
||
|
endfunction(cxx_test)
|