[CMake] CMake chokes on hash (#) in CMAKE_MODULE_PATH
Marcel Loose
loose at astron.nl
Wed Apr 28 10:31:49 EDT 2010
Hi all,
Accidentally, I found out that CMake chokes when CMAKE_MODULE_PATH
contains a hash (#). This already happens when trying whether the C
compiler works.
The problem is caused by under-quoting of CMAKE_MODULE_PATH in line 2
of /tmp/loose/cmake/#/build/CMakeFiles/CMakeTmp/CMakeLists.txt (see
below).
Best regards,
Marcel Loose.
$ pwd
/tmp/loose/cmake/#/build
$ cat ../CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(Hash)
$ cmake --debug-trycompile -DCMAKE_MODULE_PATH="/tmp/loose/cmake/#" ..
debug trycompile on
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
CMake Error: Error in cmake code at
/tmp/loose/cmake/#/build/CMakeFiles/CMakeTmp/CMakeLists.txt:11:
Parse error. Function missing ending ")". End of file reached.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:32
(MESSAGE):
The C compiler "/usr/bin/gcc" is not able to compile a simple test
program.
It fails with the following output:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
$ cat /tmp/loose/cmake/#/build/CMakeFiles/CMakeTmp/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_MODULE_PATH /tmp/loose/cmake/#)
PROJECT(CMAKE_TRY_COMPILE C)
SET(CMAKE_VERBOSE_MAKEFILE 1)
SET(CMAKE_C_FLAGS " ${COMPILE_DEFINITIONS}")
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})
SET(CMAKE_SUPPRESS_REGENERATION 1)
LINK_DIRECTORIES(${LINK_DIRECTORIES})
ADD_EXECUTABLE(cmTryCompileExec
"/tmp/loose/cmake/#/build/CMakeFiles/CMakeTmp/testCCompiler.c")
TARGET_LINK_LIBRARIES(cmTryCompileExec ${LINK_LIBRARIES})
More information about the CMake
mailing list