[CMake] How to choose a compiler different from default?
Hi, I following the following steps to compile gtest. https://code.google.com/p/tonatiuh/wiki/GoogleTest But the following output shows that it uses the default compiler on Mac OS X. I want to use some other compiler. Does anybody know how to instruct cmake to do so? Thanks. /tmp/gtest-1.7.0/mybuild$ cmake -G"Unix Makefiles" .. -- The CXX compiler identification is AppleClang 6.0.0.657 -- The C compiler identification is AppleClang 6.0.0.657 -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/2.7/bin/python (found version "2.7.8") -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE -- Configuring done -- Generating done -- Build files have been written to: /tmp/gtest-1.7.0/mybuild /tmp/gtest-1.7.0/mybuild$ make VERBOSE=1 /usr/local/Cellar/cmake/3.2.2/bin/cmake -H/tmp/gtest-1.7.0 -B/tmp/gtest-1.7.0/mybuild --check-build-system CMakeFiles/Makefile.cmake 0 /usr/local/Cellar/cmake/3.2.2/bin/cmake -E cmake_progress_start /tmp/gtest-1.7.0/mybuild/CMakeFiles /tmp/gtest-1.7.0/mybuild/CMakeFiles/progress.marks /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/gtest.dir/build.make CMakeFiles/gtest.dir/depend cd /tmp/gtest-1.7.0/mybuild && /usr/local/Cellar/cmake/3.2.2/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/gtest-1.7.0 /tmp/gtest-1.7.0 /tmp/gtest-1.7.0/mybuild /tmp/gtest-1.7.0/mybuild /tmp/gtest-1.7.0/mybuild/CMakeFiles/gtest.dir/DependInfo.cmake --color= Dependee "/tmp/gtest-1.7.0/mybuild/CMakeFiles/gtest.dir/DependInfo.cmake" is newer than depender "/tmp/gtest-1.7.0/mybuild/CMakeFiles/gtest.dir/depend.internal". Dependee "/tmp/gtest-1.7.0/mybuild/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/tmp/gtest-1.7.0/mybuild/CMakeFiles/gtest.dir/depend.internal". Scanning dependencies of target gtest /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/gtest.dir/build.make CMakeFiles/gtest.dir/build /usr/local/Cellar/cmake/3.2.2/bin/cmake -E cmake_progress_report /tmp/gtest-1.7.0/mybuild/CMakeFiles 1 [ 50%] Building CXX object CMakeFiles/gtest.dir/src/gtest-all.cc.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -I/tmp/gtest-1.7.0/include -I/tmp/gtest-1.7.0 -DGTEST_HAS_PTHREAD=1 -o CMakeFiles/gtest.dir/src/gtest-all.cc.o -c /tmp/gtest-1.7.0/src/gtest-all.cc Linking CXX static library libgtest.a /usr/local/Cellar/cmake/3.2.2/bin/cmake -P CMakeFiles/gtest.dir/cmake_clean_target.cmake /usr/local/Cellar/cmake/3.2.2/bin/cmake -E cmake_link_script CMakeFiles/gtest.dir/link.txt --verbose=1 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar cq libgtest.a CMakeFiles/gtest.dir/src/gtest-all.cc.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib libgtest.a /usr/local/Cellar/cmake/3.2.2/bin/cmake -E cmake_progress_report /tmp/gtest-1.7.0/mybuild/CMakeFiles 1 [ 50%] Built target gtest /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/gtest_main.dir/build.make CMakeFiles/gtest_main.dir/depend cd /tmp/gtest-1.7.0/mybuild && /usr/local/Cellar/cmake/3.2.2/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/gtest-1.7.0 /tmp/gtest-1.7.0 /tmp/gtest-1.7.0/mybuild /tmp/gtest-1.7.0/mybuild /tmp/gtest-1.7.0/mybuild/CMakeFiles/gtest_main.dir/DependInfo.cmake --color= Dependee "/tmp/gtest-1.7.0/mybuild/CMakeFiles/gtest_main.dir/DependInfo.cmake" is newer than depender "/tmp/gtest-1.7.0/mybuild/CMakeFiles/gtest_main.dir/depend.internal". Dependee "/tmp/gtest-1.7.0/mybuild/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/tmp/gtest-1.7.0/mybuild/CMakeFiles/gtest_main.dir/depend.internal". Scanning dependencies of target gtest_main /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/gtest_main.dir/build.make CMakeFiles/gtest_main.dir/build /usr/local/Cellar/cmake/3.2.2/bin/cmake -E cmake_progress_report /tmp/gtest-1.7.0/mybuild/CMakeFiles 2 [100%] Building CXX object CMakeF
Re: [CMake] How to build only when file contents are actually changed?
>> o Makepp will not recompile if only comments or whitespace in >> C/C++ sources have changed. This is especially important for header >> files which are automatically generated by other programs and are >> included in many modules. Even if the date has changed because the >> file was remade, makepp won't recompile if the file hasn't changed. >> > > That's plenty dangerous! Only a full C/C++ compiler can decide whether > something is a comment or not (as this requires full parsing > capabilities) and further it might interfere with compiler bugs; I > remember having the problem that with -O3 and old version of the Apple > GCC produced code that segfaulted depending on whether a certain comment > line was present or not! This depends on how many different things in C++ are used. With some restrictions, the drawbacks of this approach can be circumvented. To work with some legacy code which include things that may cause failure, makepp may not be the appropriate tool. For a project starting from scratch (so these intruding things can be forbidden), makepp can be a very good tool as it results in much less makefile to write compared with cmake. -- 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] How to build only when file contents are actually changed?
> You miss the point. If CMake wanted to offer hash-based checking, it > would need to do so for *all* backends, not just GNU Make. Good look > implementing that hack in Visual Studio or Xcode... I get your point that there is not an easy to do content based dependency (hash as an approximation) for all backends. For the reason mentioned below, I'd think that content based dependency is important. The support for this feature should be considered first for GNU make, which does seem to be too difficult (as it just requires some additional rules). The support for *all* backends can be added later on one by one. o Makepp will not recompile if only comments or whitespace in C/C++ sources have changed. This is especially important for header files which are automatically generated by other programs and are included in many modules. Even if the date has changed because the file was remade, makepp won't recompile if the file hasn't changed. -- 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] How to build only when file contents are actually changed?
> Again, using ccache solves this much more elegantly. And calling md5sum > twice is also not very nice... I'm not sure ccache replaces hash. My understanding is that ccache speed up individual compilation, but all the targets that depends on it are still compiled. With hash, a file is checked first whether it should be recompiled, if not, it will not be recompiled, and all the targets that depend on it will not be compiled either. I'm not with a machine that I can check ccache as this moment. Please correct me if I'm wrong. The following compares a few features. But since it is from waf, it might be biased in favor of waf. Nevertheless, there are some features that available in other tools missing in cmake. http://code.google.com/p/waf/wiki/WafAndOtherBuildSystems -- 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] How to build only when file contents are actually changed?
> CMake really leaves the decision when to recompile something to the > backend, i.e. GNU Make, Xcode, Visual Studio, ninja etc. It merely > defines dependencies and then lets the actual build tool handle the > rest, and most of them choose to use simple time-stamps instead of Although GNU Make natively does not support build on content change, it can be hijacked using the trick in the link that I mentioned. I think that it is not impossible to do so in cmake at the language level. But it is better if cmake can support this natively. Yes this is a feature request not a bug report. (To J Decker) This feature is available to scons. And I think it is reasonable to expect cmake also have it. I seems that people here did think about it seriously before, which is a surprise to me. http://www.scons.org/doc/0.97/HTML/scons-user/c762.html > hashes. Also note that computing the hash might also incur considerable > overhead, in particular for very large projects with thousands of files. It might or might not. The decision should be up to the users. In a lot of cases, using hash is faster than recompile the objects. -- 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
[CMake] How to build only when file contents are actually changed?
Hi, The following command output shows that when I touch a source without changing the content, the source are compiled and linked, which is a waste. This post shows how to use the checksum to decide whether a file is changed or not, if changed then update target. This feature seems to be missing in cmake. In case that I miss something in the document, could anybody let me know if this is the case? http://blog.jgc.org/2006/04/rebuilding-when-hash-has-changed-not.html ~/linux/test/cmake/lang/command/target_link_libraries/src$ cat.sh * ==> CMakeLists.txt <== cmake_minimum_required(VERSION 2.8) add_library(print print.cpp) #include_directories(${HELLO_SOURCE_DIR}) add_executable(main main.cpp) target_link_libraries(main print) ==> main.cpp <== #include "print.hpp" int main() { print(); } ==> print.cpp <== #include "print.hpp" #include using namespace std; void print() { cout << "Hello, World!" << endl; } ==> print.hpp <== #ifndef _hello_h #define _hello_h void print(); #endif ~/linux/test/cmake/lang/command/target_link_libraries/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: /Users/pengy/linux/test/cmake/lang/command/target_link_libraries/build ~/linux/test/cmake/lang/command/target_link_libraries/build$ make Scanning dependencies of target print [ 50%] Building CXX object CMakeFiles/print.dir/print.cpp.o Linking CXX static library libprint.a [ 50%] Built target print Scanning dependencies of target main [100%] Building CXX object CMakeFiles/main.dir/main.cpp.o Linking CXX executable main [100%] Built target main ~/linux/test/cmake/lang/command/target_link_libraries/build$ touch ../src/print.hpp ~/linux/test/cmake/lang/command/target_link_libraries/build$ make Scanning dependencies of target print [ 50%] Building CXX object CMakeFiles/print.dir/print.cpp.o Linking CXX static library libprint.a [ 50%] Built target print Scanning dependencies of target main [100%] Building CXX object CMakeFiles/main.dir/main.cpp.o Linking CXX executable main [100%] Built target main -- 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] How to suppress output like "-- Checking whether C ", etc.?
On Mon, Aug 13, 2012 at 3:37 PM, Andreas Pakulat wrote: > Hi, > > you can't tell cmake to do this and usually you don't want to either. > These are status messages indicating what cmake is using so you can According to the common linux philosophy, mostly status messages like this are suppressed in other tools unless otherwise instructed. Therefore, I think that it may be better to suppress these messages by default and add an option in cmake to enable them when users want these messages. After all, when cmake runs successfully, these messages are useless and just make the output look ugly. > easily spot if cmake chose the wrong compiler or found a library in a > place where you didn't expect it. > > To suppress all non-error output you can do: > > cmake ../ >/dev/null > > on *nix systems. That way only errors in your cmake files are being shown. > > Andreas > > On Mon, Aug 13, 2012 at 9:42 PM, Peng Yu wrote: >> Hi, >> >> I just want "Hello World!" to be shown and everything else be >> suppressed. "-Wno-dev" seems not relevant. I don't find other options >> seem to be useful in the manual. In case I miss anything in the >> manual, is there an option to suppress these messages? Thanks! >> >> ~/linux/test/cmake/lang/command/message/build$ cat ../src1/CMakeLists.txt >> message("Hello World!") >> ~/linux/test/cmake/lang/command/message/build$ rm -rf * >> ~/linux/test/cmake/lang/command/message/build$ cmake ../src1/ >> -- 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 >> Hello World! >> -- Configuring done >> -- Generating done >> -- Build files have been written to: >> /Users/pengy/linux/test/cmake/lang/command/message/build >> >> >> -- >> 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 -- 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
[CMake] How to force cmake to run on a different source directory?
Hi, The following directory has 'cmake ../src1' run before. I get the following error when I run the following command. One way to solve the problem is to run "rm -rf *", but I'm wondering if there is a way to force cmake to run even when the source directory changes. I don't see such a command line option in the manual. Thanks! ~/linux/test/cmake/lang/command/message/build$ cmake ../src/ CMake Error: The source "/Users/pengy/linux/test/cmake/lang/command/message/src/CMakeLists.txt" does not match the source "/Users/pengy/linux/test/cmake/lang/command/message/src1/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory. -- 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
[CMake] How to suppress output like "-- Checking whether C ", etc.?
Hi, I just want "Hello World!" to be shown and everything else be suppressed. "-Wno-dev" seems not relevant. I don't find other options seem to be useful in the manual. In case I miss anything in the manual, is there an option to suppress these messages? Thanks! ~/linux/test/cmake/lang/command/message/build$ cat ../src1/CMakeLists.txt message("Hello World!") ~/linux/test/cmake/lang/command/message/build$ rm -rf * ~/linux/test/cmake/lang/command/message/build$ cmake ../src1/ -- 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 Hello World! -- Configuring done -- Generating done -- Build files have been written to: /Users/pengy/linux/test/cmake/lang/command/message/build -- 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] cmake manpage in pdf with section (subsection, etc) bookmarks and hyperlinks?
> $ docbook2pdf cmake-help.docbook I got error message like the following on ubuntu. openjade:/home/pengy/cmake-help.docbook:13:14:E: end tag for "itemizedlist" which is not finished openjade:/home/pengy/cmake-help.docbook:21:14:E: end tag for "itemizedlist" which is not finished openjade:/home/pengy/cmake-help.docbook:30:14:E: end tag for "itemizedlist" which is not finished ... cmake version 2.8.5 -- 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
[CMake] cmake manpage in pdf with section (subsection, etc) bookmarks and hyperlinks?
Hi, I use the following command to generate the pdf file from cmake manpage. But the pdf file does not have bookmarks. Does anybody know a way to generated the manual in pdf with bookmarks and possibly hyperlinks? man -t "$f" | ps2pdf - > $f.pdf -- 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
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
[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