From 63ead2010d7b2d51861e650133662c3518cd0d09 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Tue, 16 Oct 2012 16:35:28 +0200 Subject: [PATCH] Cmake build: support tests Next try to make it to work on APPLE (and maybe on WIN32) a.) Create the needed data-dir at configure time b.) Use different target names for executable and data created with them --- src/support/tests/CMakeLists.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/support/tests/CMakeLists.txt b/src/support/tests/CMakeLists.txt index 213b578a4f..eb6c2a1f48 100644 --- a/src/support/tests/CMakeLists.txt +++ b/src/support/tests/CMakeLists.txt @@ -28,20 +28,22 @@ include_directories( set(check_PROGRAMS check_convert check_filetools check_lstrings) +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/regfiles") + set(_depends) foreach(_src ${check_PROGRAMS}) sources(${_src} ${_src}.cpp dummy_functions.cpp boost.cpp) - #message(STATUS "${_src}_SOURCES = " ${${_src}_SOURCES}) string(REPLACE "check_" "" _srcx ${_src}) + set(src_data_file "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}") + set(created_data_file "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}_data") add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src} - COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/regfiles" - COMMAND "${CMAKE_BINARY_DIR}/bin/${_src}" > ${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src} - COMMAND ${CMAKE_COMMAND} -E compare_files "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}" "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}" - DEPENDS "${CMAKE_BINARY_DIR}/bin/${_src}" "${TOP_SRC_DIR}/src/support/tests/regfiles/${_srcx}" - COMMENT "'${CMAKE_BINARY_DIR}/bin/${_src}' > '${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}'" + OUTPUT "${created_data_file}" + COMMAND ${_src} > "${created_data_file}" + COMMAND ${CMAKE_COMMAND} -E compare_files "${src_data_file}" "${created_data_file}" + DEPENDS ${_src} "${src_data_file}" + COMMENT "${_src} > '${created_data_file}'" ) - list(APPEND _depends "${CMAKE_CURRENT_BINARY_DIR}/regfiles/${_src}") + list(APPEND _depends "${created_data_file}") endforeach() add_custom_target(checkregfiles DEPENDS support ${_depends})