Merge topic 'ExternalData-spaces'

55f0148 ExternalData: Test content link with a space in its name
d45eb35 Tests: Generalize decision for 'make' tool supporting spaces
ef8b2fd Tests: Replace exec_program with execute_process
This commit is contained in:
Brad King 2013-02-25 13:11:51 -05:00 committed by CMake Topic Stage
commit 05e1b3c17d
4 changed files with 37 additions and 19 deletions

View File

@ -50,6 +50,26 @@ if(BUILD_TESTING)
set(TEST_CompileCommandOutput 1) set(TEST_CompileCommandOutput 1)
endif() endif()
set(MAKE_IS_GNU )
if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version
RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
if("${res}" STREQUAL "0")
if("${out}" MATCHES "GNU")
set(MAKE_IS_GNU 1)
endif()
endif()
endif()
# some old versions of make simply cannot handle spaces in paths
if (MAKE_IS_GNU OR
"${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
"${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
set(MAKE_SUPPORTS_SPACES 1)
else()
set(MAKE_SUPPORTS_SPACES 0)
endif()
set(build_generator_args set(build_generator_args
--build-generator ${CMAKE_TEST_GENERATOR} --build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
@ -327,6 +347,7 @@ if(BUILD_TESTING)
--build-project ExternalDataTest --build-project ExternalDataTest
--build-noclean --build-noclean
--force-new-ctest-process --force-new-ctest-process
--build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES}
--test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData")
@ -384,7 +405,8 @@ if(BUILD_TESTING)
# mainly it tests that cmake doesn't crash when generating these project files. # mainly it tests that cmake doesn't crash when generating these project files.
if(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop") if(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
# check which generators we have # check which generators we have
exec_program(${CMAKE_CMAKE_COMMAND} ARGS --help OUTPUT_VARIABLE cmakeOutput ) execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help
OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput)
# check for the Eclipse generator # check for the Eclipse generator
if ("${cmakeOutput}" MATCHES Eclipse) if ("${cmakeOutput}" MATCHES Eclipse)
add_test(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND} add_test(Simple_EclipseGenerator ${CMAKE_CTEST_COMMAND}
@ -1237,24 +1259,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
) )
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys")
endif() endif()
set(MAKE_IS_GNU )
if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
exec_program(
${CMAKE_TEST_MAKEPROGRAM} ARGS no_such_target --version
RETURN_VALUE res OUTPUT_VARIABLE out
)
if("${res}" EQUAL 0)
if("${out}" MATCHES "GNU")
set(MAKE_IS_GNU 1)
endif()
endif()
endif()
# only add this test on platforms that support it if(MAKE_SUPPORTS_SPACES)
# some old versions of make simply cannot handle spaces in paths
if (MAKE_IS_GNU OR
"${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
"${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDirSpaces" "${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
@ -2397,7 +2403,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(TEST_CompileCommandOutput) if(TEST_CompileCommandOutput)
set(CompileCommandOutput_EXTRA_OPTIONS set(CompileCommandOutput_EXTRA_OPTIONS
--build-options -DMAKE_SUPPORTS_SPACES=${MAKE_IS_GNU}) --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES})
ADD_TEST_MACRO(CompileCommandOutput ADD_TEST_MACRO(CompileCommandOutput
"${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands") "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands")
endif() endif()

View File

@ -14,10 +14,15 @@ set(ExternalData_URL_TEMPLATES
set(ExternalData_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ExternalData") set(ExternalData_BINARY_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ExternalData")
file(REMOVE_RECURSE ${ExternalData_BINARY_ROOT}) # clean test file(REMOVE_RECURSE ${ExternalData_BINARY_ROOT}) # clean test
if(MAKE_SUPPORTS_SPACES)
set(Data1CheckSpaces -D "DataSpace=DATA{Data Space.dat}")
endif()
ExternalData_Add_Test(Data1 ExternalData_Add_Test(Data1
NAME Data1Check NAME Data1Check
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-D Data=DATA{Data.dat} -D Data=DATA{Data.dat}
${Data1CheckSpaces}
-D SeriesA=DATA{SeriesA.dat,:} -D SeriesA=DATA{SeriesA.dat,:}
-D SeriesB=DATA{SeriesB.dat,:} -D SeriesB=DATA{SeriesB.dat,:}
-D SeriesC=DATA{SeriesC.dat,:} -D SeriesC=DATA{SeriesC.dat,:}

View File

@ -0,0 +1 @@
8c018830e3efa5caf3c7415028335a57

View File

@ -2,6 +2,12 @@ file(STRINGS "${Data}" lines LIMIT_INPUT 1024)
if(NOT "x${lines}" STREQUAL "xInput file already transformed.") if(NOT "x${lines}" STREQUAL "xInput file already transformed.")
message(SEND_ERROR "Input file:\n ${Data}\ndoes not have expected content, but [[${lines}]]") message(SEND_ERROR "Input file:\n ${Data}\ndoes not have expected content, but [[${lines}]]")
endif() endif()
if(DEFINED DataSpace)
file(STRINGS "${DataSpace}" lines LIMIT_INPUT 1024)
if(NOT "x${lines}" STREQUAL "xInput file already transformed.")
message(SEND_ERROR "Input file:\n ${DataSpace}\ndoes not have expected content, but [[${lines}]]")
endif()
endif()
set(SeriesAn1 "1\\.dat") set(SeriesAn1 "1\\.dat")
set(SeriesBn1 "_1\\.dat") set(SeriesBn1 "_1\\.dat")
set(SeriesCn1 "\\.1\\.dat") set(SeriesCn1 "\\.1\\.dat")