Fix CompileCommandOutput test for Make tools not supporting spaces

Use underscores instead of spaces for such Make tools.
This commit is contained in:
Brad King 2011-05-19 08:11:34 -04:00
parent 4268e3d7e9
commit 7039d1fd9b
7 changed files with 16 additions and 7 deletions

View File

@ -11,6 +11,7 @@ MACRO(ADD_TEST_MACRO NAME COMMAND)
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project ${proj}
${${NAME}_EXTRA_OPTIONS}
--test-command ${COMMAND} ${ARGN})
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${dir}")
ENDMACRO(ADD_TEST_MACRO)
@ -2037,6 +2038,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ENDFOREACH()
IF(TEST_CompileCommandOutput)
SET(CompileCommandOutput_EXTRA_OPTIONS
--build-options -DMAKE_SUPPORTS_SPACES=${MAKE_IS_GNU})
ADD_TEST_MACRO(CompileCommandOutput
"${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands")
ENDIF()

View File

@ -4,7 +4,12 @@ project (CompileCommandOutput CXX)
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
ADD_LIBRARY(test1 STATIC "file with spaces.cxx")
IF(MAKE_SUPPORTS_SPACES)
SET(test1_srcs "file with spaces.cxx")
ELSE()
SET(test1_srcs "file_with_underscores.cxx")
ENDIF()
ADD_LIBRARY(test1 STATIC ${test1_srcs})
ADD_LIBRARY(test2 SHARED "../CompileCommandOutput/relative.cxx")
INCLUDE_DIRECTORIES(${CompileCommandOutput_SOURCE_DIR}/../../Source)
ADD_EXECUTABLE(CompileCommandOutput compile_command_output.cxx)

View File

@ -1,9 +1,9 @@
#include "file with spaces.h"
#include "file_with_underscores.h"
#include "relative.h"
int main (int argc, char** argv)
{
file_with_spaces();
file_with_underscores();
relative();
return 0;
}

View File

@ -1,3 +1 @@
#include "file with spaces.h"
void file_with_spaces() {}
#include "file_with_underscores.cxx"

View File

@ -1 +0,0 @@
void file_with_spaces();

View File

@ -0,0 +1,3 @@
#include "file_with_underscores.h"
void file_with_underscores() {}

View File

@ -0,0 +1 @@
void file_with_underscores();