[CMake] Bug when $ is in the directory path
Hi, I have the following example copied from the cmake Tests/Tutorial directory. cmake works fine. /tmp/xxx/src$ cat.sh * ==> CMakeLists.txt <== cmake_minimum_required (VERSION 2.6) project (Tutorial) # The version number. set (Tutorial_VERSION_MAJOR 1) set (Tutorial_VERSION_MINOR 0) # configure a header file to pass some of the CMake settings # to the source code configure_file ( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h" ) # add the binary tree to the search path for include files # so that we will find TutorialConfig.h include_directories("${PROJECT_BINARY_DIR}") # add the executable add_executable(tutorial.exe tutorial.cpp) ==> TutorialConfig.h.in <== // the configured options and settings for Tutorial #define Tutorial_VERSION_MAJOR ${Tutorial_VERSION_MAJOR} #define Tutorial_VERSION_MINOR ${Tutorial_VERSION_MINOR} ==> tutorial.cpp <== // A simple program that computes the square root of a number #include #include "TutorialConfig.h" int main (int argc, char *argv[]) { fprintf(stdout,"%s Version %d.%d\n", argv[0], Tutorial_VERSION_MAJOR, Tutorial_VERSION_MINOR); return 0; } When I mv xxx to '$' /tmp/$$ dir build src I get the following error. This is must be due to a bug in cmake such that it can not handle directory path with '$' in it. Could anybody fix it? Thanks! /tmp/$/build$ cmake ../src/ -- The C compiler identification is GNU 4.2.1 -- The CXX compiler identification is GNU 4.2.1 -- Checking whether C compiler has -isysroot -- Checking whether C compiler has -isysroot - yes -- Checking whether C compiler supports OSX deployment target flag -- Checking whether C compiler supports OSX deployment target flag - yes -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Checking whether CXX compiler has -isysroot -- Checking whether CXX compiler has -isysroot - yes -- Checking whether CXX compiler supports OSX deployment target flag -- Checking whether CXX compiler supports OSX deployment target flag - yes -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /tmp/$/build /tmp/$/build$ dir CMakeCache.txt CMakeFiles Makefile TutorialConfig.h cmake_install.cmake /tmp/$/build$ make Scanning dependencies of target tutorial.exe make[2]: *** No rule to make target `/tmp/src/tutorial.cpp', needed by `CMakeFiles/tutorial.exe.dir/tutorial.cpp.o'. Stop. make[1]: *** [CMakeFiles/tutorial.exe.dir/all] Error 2 make: *** [all] Error 2 -- Regards, Peng -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Bug when $ is in the directory path
The offending line is this. /tmp/$/build$ grep -H -n '/tmp/$/src/tutorial.cpp' CMakeFiles/tutorial.exe.dir/build.make CMakeFiles/tutorial.exe.dir/build.make:53:CMakeFiles/tutorial.exe.dir/tutorial.cpp.o: /tmp/$/src/tutorial.cpp This is obviously a bug in cmake but not a bug in make, as special treatment must be done for '$' in Makefile (see the following example). I hope that it is helpful to the development of cmake by providing this kind of corner case test. ~/linux/test/gnu/make/$$ cat Makefile .PHONY: all all: ../$$/out.txt ../$$/out.txt: ../$$/in.txt cp $< $@ clean: $(RM) ../$$/out.txt ~/linux/test/gnu/make/$$ make clean rm -f ../$/out.txt Just in case my make and cmake are not the newest. And the bug has been fixed in later version. Here are my make and cmake versions. ~/linux/test/gnu/make/$$ make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-apple-darwin10.0 ~/linux/test/gnu/make/$$ cmake --version cmake version 2.8.8 > First of all, this is not a bugtracker. If you want your bug fixed, > you should file it in the kitware bugtracker. It is nonetheless helpful to discuss it here. Obviously, you did not think it is a bug. There are also previous bug discussions on this mailing list. -- Regards, Peng -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Bug when $ is in the directory path
> andreas@warnemuende /tmp/$/foo % cat main.cpp > int main() > { > return 0; > } > > andreas@warnemuende /tmp/$/foo % cat CMakeLists.txt > add_executable(foo main.cpp) > > Can you try that on your side to see wether it works? The error still exits. /tmp/$/foo_build$ cmake ../foo -- The C compiler identification is GNU 4.2.1 -- The CXX compiler identification is GNU 4.2.1 -- Checking whether C compiler has -isysroot -- Checking whether C compiler has -isysroot - yes -- Checking whether C compiler supports OSX deployment target flag -- Checking whether C compiler supports OSX deployment target flag - yes -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Checking whether CXX compiler has -isysroot -- Checking whether CXX compiler has -isysroot - yes -- Checking whether CXX compiler supports OSX deployment target flag -- Checking whether CXX compiler supports OSX deployment target flag - yes -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /tmp/$/foo_build /tmp/$/foo_build$ make Scanning dependencies of target foo make[2]: *** No rule to make target `/tmp/foo/main.cpp', needed by `CMakeFiles/foo.dir/main.cpp.o'. Stop. make[1]: *** [CMakeFiles/foo.dir/all] Error 2 make: *** [all] Error 2 /tmp/$/foo_build$ cat.sh ../foo/ CMakeLists.txt main.cpp /tmp/$/foo_build$ cat.sh ../foo/* ==> ../foo/CMakeLists.txt <== add_executable(foo main.cpp) ==> ../foo/main.cpp <== int main() { return 0; } -- Regards, Peng -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake