diff options
author | Oscar Fuentes <ofv@wanadoo.es> | 2011-04-12 22:10:38 +0000 |
---|---|---|
committer | Oscar Fuentes <ofv@wanadoo.es> | 2011-04-12 22:10:38 +0000 |
commit | 2a2bc5ccee61d007a224a89da0bd823641265444 (patch) | |
tree | e3a23d03f992a1cbf5627e7dad6a9e8608cf0b27 /test/CMakeLists.txt | |
parent | ec51a6225c59fee9021b8b6c7c813228cb27a3fa (diff) |
Fix compiler command line used by lit.py when working with NMake
generators. It may improve robustness when testing from VS too.
Based on a patch by David Neto!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129398 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CMakeLists.txt')
-rw-r--r-- | test/CMakeLists.txt | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b696682c13..993b6e2744 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,14 +37,32 @@ if(PYTHONINTERP_FOUND) foreach(INC_DIR ${INC_DIRS}) set(IDIRS "${IDIRS} -I${INC_DIR}") endforeach() - string(REPLACE "<CMAKE_CXX_COMPILER>" "${CMAKE_CXX_COMPILER}" TEST_COMPILE_CXX_CMD ${CMAKE_CXX_COMPILE_OBJECT}) + + if( MSVC ) + # The compiler's path may contain white space. Wrap it: + string(REPLACE "<CMAKE_CXX_COMPILER>" "\\\"${CMAKE_CXX_COMPILER}\\\"" TEST_COMPILE_CXX_CMD ${CMAKE_CXX_COMPILE_OBJECT}) + # Eliminate continuation lines from NMake flow. PR9680 + string(REPLACE "@<<\n" " " TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) + string(REPLACE "\n<<" " " TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) + else() + string(REPLACE "<CMAKE_CXX_COMPILER>" "${CMAKE_CXX_COMPILER}" TEST_COMPILE_CXX_CMD ${CMAKE_CXX_COMPILE_OBJECT}) + endif() + string(REPLACE "<DEFINES>" "${DEFS}" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) string(REPLACE "<FLAGS>" "${CMAKE_CXX_FLAGS}" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) - string(REPLACE "-o" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) + if (MSVC) # PR9680 + # Eliminate MSVC equivalent of -o + string(REPLACE "/Fo<OBJECT>" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) + # Eliminate "how to rename program database" argument + string(REPLACE "/Fd<TARGET_PDB>" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) + else() + string(REPLACE "-o" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) + endif(MSVC) string(REGEX REPLACE "<[^>]+>" "" TEST_COMPILE_CXX_CMD ${TEST_COMPILE_CXX_CMD}) set(TEST_COMPILE_CXX_CMD "${TEST_COMPILE_CXX_CMD} ${IDIRS}") if(NOT MSVC) set(TEST_COMPILE_CXX_CMD "${TEST_COMPILE_CXX_CMD} -x c++") + # MSVC already has /TP to indicate a C++ source file endif() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in |