[test-suite] r259970 - cmake: Fix quoting of quotation marks in append_cflags()

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 17:11:37 PST 2016


Author: matze
Date: Fri Feb  5 19:11:36 2016
New Revision: 259970

URL: http://llvm.org/viewvc/llvm-project?rev=259970&view=rev
Log:
cmake: Fix quoting of quotation marks in append_cflags()

Modified:
    test-suite/trunk/MultiSource/Benchmarks/FreeBench/analyzer/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/FreeBench/distray/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/FreeBench/fourinarow/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/FreeBench/mason/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/FreeBench/neural/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/FreeBench/pcompress2/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/FreeBench/pifft/CMakeLists.txt
    test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/CMakeLists.txt
    test-suite/trunk/cmake/modules/SingleMultiSource.cmake

Modified: test-suite/trunk/MultiSource/Benchmarks/FreeBench/analyzer/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/FreeBench/analyzer/CMakeLists.txt?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/FreeBench/analyzer/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/FreeBench/analyzer/CMakeLists.txt Fri Feb  5 19:11:36 2016
@@ -1,5 +1,5 @@
 set(PROG analyzer)
-set(CPPFLAGS -DVERSION='"1.00"' -DCOMPDATE="\\"today\\"" -DCFLAGS='""' -DHOSTNAME="\\"thishost\\"" )
+set(CPPFLAGS -DVERSION="1.00" -DCOMPDATE="today" -DCFLAGS="" -DHOSTNAME="thishost")
 if(DEFINED LARGE_PROBLEM_SIZE)
   set(RUN_OPTIONS ${CMAKE_CURRENT_SOURCE_DIR}/ref.in)
 else()

Modified: test-suite/trunk/MultiSource/Benchmarks/FreeBench/distray/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/FreeBench/distray/CMakeLists.txt?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/FreeBench/distray/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/FreeBench/distray/CMakeLists.txt Fri Feb  5 19:11:36 2016
@@ -1,5 +1,5 @@
 set(PROG distray)
-set(CPPFLAGS -DVERSION='"1.00"' -DCOMPDATE="\\"today\\"" -DCFLAGS='""' -DHOSTNAME="\\"thishost\\"" )
+set(CPPFLAGS -DVERSION="1.00" -DCOMPDATE="today" -DCFLAGS="" -DHOSTNAME="thishost")
 set(LDFLAGS -lm)
 if(DEFINED LARGE_PROBLEM_SIZE)
   set(RUN_OPTIONS ${CMAKE_CURRENT_SOURCE_DIR}/ref.in)

Modified: test-suite/trunk/MultiSource/Benchmarks/FreeBench/fourinarow/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/FreeBench/fourinarow/CMakeLists.txt?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/FreeBench/fourinarow/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/FreeBench/fourinarow/CMakeLists.txt Fri Feb  5 19:11:36 2016
@@ -1,5 +1,5 @@
 set(PROG fourinarow)
-set(CPPFLAGS -DVERSION='"1.00"' -DCOMPDATE="\\"today\\"" -DCFLAGS='""' -DHOSTNAME="\\"thishost\\"" )
+set(CPPFLAGS -DVERSION="1.00" -DCOMPDATE="today" -DCFLAGS="" -DHOSTNAME="thishost")
 if(DEFINED LARGE_PROBLEM_SIZE)
   set(RUN_OPTIONS ${CMAKE_CURRENT_SOURCE_DIR}/ref.in)
 else()

Modified: test-suite/trunk/MultiSource/Benchmarks/FreeBench/mason/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/FreeBench/mason/CMakeLists.txt?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/FreeBench/mason/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/FreeBench/mason/CMakeLists.txt Fri Feb  5 19:11:36 2016
@@ -1,5 +1,5 @@
 set(PROG mason)
-set(CPPFLAGS -DVERSION='"1.00"' -DCOMPDATE="\\"today\\"" -DCFLAGS='""' -DHOSTNAME="\\"thishost\\"" )
+set(CPPFLAGS -DVERSION="1.00" -DCOMPDATE="today" -DCFLAGS="" -DHOSTNAME="thishost")
 if(DEFINED LARGE_PROBLEM_SIZE)
   set(RUN_OPTIONS ${CMAKE_CURRENT_SOURCE_DIR}/ref.in)
 else()

Modified: test-suite/trunk/MultiSource/Benchmarks/FreeBench/neural/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/FreeBench/neural/CMakeLists.txt?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/FreeBench/neural/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/FreeBench/neural/CMakeLists.txt Fri Feb  5 19:11:36 2016
@@ -1,5 +1,5 @@
 set(PROG neural)
-set(CPPFLAGS -DVERSION='"1.00"' -DCOMPDATE="\\"today\\"" -DCFLAGS='""' -DHOSTNAME="\\"thishost\\"" )
+set(CPPFLAGS -DVERSION="1.00" -DCOMPDATE="today" -DCFLAGS="" -DHOSTNAME="thishost")
 set(LDFLAGS -lm)
 if(DEFINED LARGE_PROBLEM_SIZE)
   set(RUN_OPTIONS ${CMAKE_CURRENT_SOURCE_DIR}/ref.in)

Modified: test-suite/trunk/MultiSource/Benchmarks/FreeBench/pcompress2/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/FreeBench/pcompress2/CMakeLists.txt?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/FreeBench/pcompress2/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/FreeBench/pcompress2/CMakeLists.txt Fri Feb  5 19:11:36 2016
@@ -1,5 +1,5 @@
 set(PROG pcompress2)
-set(CPPFLAGS -DVERSION='"1.00"' -DCOMPDATE="\\"today\\"" -DCFLAGS='""' -DHOSTNAME="\\"thishost\\"" )
+set(CPPFLAGS -DVERSION="1.00" -DCOMPDATE="today" -DCFLAGS="" -DHOSTNAME="thishost")
 if(DEFINED LARGE_PROBLEM_SIZE)
   set(INPUT_FILE ref.in)
 else()

Modified: test-suite/trunk/MultiSource/Benchmarks/FreeBench/pifft/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/FreeBench/pifft/CMakeLists.txt?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/FreeBench/pifft/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/FreeBench/pifft/CMakeLists.txt Fri Feb  5 19:11:36 2016
@@ -1,5 +1,5 @@
 set(PROG pifft)
-set(CPPFLAGS -DVERSION='"1.00"' -DCOMPDATE="\\"today\\"" -DCFLAGS='""' -DHOSTNAME="\\"thishost\\"" )
+set(CPPFLAGS -DVERSION="1.00" -DCOMPDATE="today" -DCFLAGS="" -DHOSTNAME="thishost")
 set(LDFLAGS -lm)
 if(DEFINED LARGE_PROBLEM_SIZE)
   set(RUN_OPTIONS ${CMAKE_CURRENT_SOURCE_DIR}/ref.in)

Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/CMakeLists.txt?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/CMakeLists.txt (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/CMakeLists.txt Fri Feb  5 19:11:36 2016
@@ -1,6 +1,6 @@
 set(PROG gs)
 list(APPEND LDFLAGS -lm)
-list(APPEND CPPFLAGS -DNOMEMOPT -DGS_LIB_DEFAULT=\\"${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_SOURCE_DIR}/fonts\\")
+list(APPEND CPPFLAGS -DNOMEMOPT -DGS_LIB_DEFAULT="${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_SOURCE_DIR}/fonts")
 list(APPEND CFLAGS -Wno-implicit-function-declaration)
 list(APPEND CPPFLAGS -DNOPRIVATE)
 set(Source gs.c gsmain.c gp_unix.c utrace.c)

Modified: test-suite/trunk/cmake/modules/SingleMultiSource.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/SingleMultiSource.cmake?rev=259970&r1=259969&r2=259970&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/SingleMultiSource.cmake (original)
+++ test-suite/trunk/cmake/modules/SingleMultiSource.cmake Fri Feb  5 19:11:36 2016
@@ -55,8 +55,13 @@ macro(append_cflags target)
     if(${old_cflags} STREQUAL "old_cflags-NOTFOUND")
       set(old_cflags)
     endif()
-    string(REPLACE ";" " " s "${old_cflags};${ARGN}")
-    set_target_properties(${target} PROPERTIES COMPILE_FLAGS ${s})
+    # Transform ${ARGN} which is a cmake list into a series of commandline
+    # arguments. This requires some shell quoting (the approach here isn't
+    # perfect)
+    string(REPLACE " " "\\ " quoted "${ARGN}")
+    string(REPLACE "\"" "\\\"" quoted "${quoted}")
+    string(REPLACE ";" " " quoted "${quoted}")
+    set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${old_cflags} ${quoted}")
   endif()
 endmacro()
 




More information about the llvm-commits mailing list