[CMake] How do I set env variables with spaces in them in a CONFIGURE_COMMAND clause of ExternalProject_add?

kent williams nkwmailinglists at gmail.com
Thu Apr 22 12:45:03 EDT 2010


I need to build TCL & TK with CFLAGS and CXXFLAGS matching what's
being used in the rest of my ExternalProjects.

The following doesn't work:

set(COMPILER_STUFF
CC=${CMAKE_C_COMPILER} C
XX=${CMAKE_CXX_COMPILER}
CFLAGS="${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}"
CXXFLAGS="${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")

set(TCL_DEPEND tcl)
set(proj tcl)
ExternalProject_Add(${proj}
CVS_REPOSITORY ":pserver:anonymous:@tcl.cvs.sourceforge.net:/cvsroot/tcl"
CVS_TAG -r core-8-5-7
CVS_MODULE  "tcl"
CONFIGURE_COMMAND
${COMPILER_STUFF}
${BRAINSTracer_BINARY_DIR}/tcl-prefix/src/tcl/unix/configure
--prefix=${BRAINSTracer_BINARY_DIR}
INSTALL_DIR ${BRAINSTracer_BINARY_DIR}
UPDATE_COMMAND ""
)

You get this error message:

cd /scratch/kent/newbuild/BT-build/
make -j1
/opt/cmake-2.9.20100421/bin/cmake
-H/scratch/kent/newbuild/BRAINSTracerQT
-B/scratch/kent/newbuild/BT-build --check-build-system
CMakeFiles/Makefile.cmake 0
-- Configuring done
-- Generating done
-- Build files have been written to: /scratch/kent/newbuild/BT-build
/opt/cmake-2.9.20100421/bin/cmake -E cmake_progress_start
/scratch/kent/newbuild/BT-build/CMakeFiles
/scratch/kent/newbuild/BT-build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/scratch/kent/newbuild/BT-build'
make -f CMakeFiles/tcl.dir/build.make CMakeFiles/tcl.dir/depend
make[2]: Entering directory `/scratch/kent/newbuild/BT-build'
cd /scratch/kent/newbuild/BT-build &&
/opt/cmake-2.9.20100421/bin/cmake -E cmake_depends "Unix Makefiles"
/scratch/kent/newbuild/BRAINSTracerQT
/scratch/kent/newbuild/BRAINSTracerQT /scratch/kent/newbuild/BT-build
/scratch/kent/newbuild/BT-build
/scratch/kent/newbuild/BT-build/CMakeFiles/tcl.dir/DependInfo.cmake
--color=
make[2]: Leaving directory `/scratch/kent/newbuild/BT-build'
make -f CMakeFiles/tcl.dir/build.make CMakeFiles/tcl.dir/build
make[2]: Entering directory `/scratch/kent/newbuild/BT-build'
/opt/cmake-2.9.20100421/bin/cmake -E cmake_progress_report
/scratch/kent/newbuild/BT-build/CMakeFiles
[  0%] Performing configure step for 'tcl'
cd /scratch/kent/newbuild/BT-build/tcl-prefix/src/tcl-build &&
CC=/usr/bin/gcc4 XX=/usr/bin/g++4 "CFLAGS=\"-m64 -O3 -DNDEBUG\""
"CXXFLAGS=\"-m64 -O3 -DNDEBUG\""
/scratch/kent/newbuild/BT-build/tcl-prefix/src/tcl/unix/configure
--prefix=/scratch/kent/newbuild/BT-build
/bin/sh: CFLAGS="-m64 -O3 -DNDEBUG": command not found
make[2]: *** [tcl-prefix/src/tcl-stamp/tcl-configure] Error 127
make[2]: Leaving directory `/scratch/kent/newbuild/BT-build'
make[1]: *** [CMakeFiles/tcl.dir/all] Error 2
make[1]: Leaving directory `/scratch/kent/newbuild/BT-build'
make: *** [all] Error 2

Compilation exited abnormally with code 2 at Thu Apr 22 11:43:43


More information about the CMake mailing list