Re: [CMake] Newbie questions: verbosity and compiler invocation
On Thursday 09 September 2010, David Aldrich wrote: Hi Michael With CMake you can use absolute and relative paths, no problem. If you use absolute paths, please use one of the pre-defined variables, such as ${CMAKE_SOURCE_DIR}, ${CMAKE_BINARY_DIR}, ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}, ${PROJECT_BINARY_DIR}, ${project_name_SOURCE_DIR} or ${project_name_BINARY_DIR}. Thanks. My situation is: -- FolderA --- CMakeLists.txt |- FolderB --- ErrorHandler.cpp As FolderB is not beneath FolderA, I don't know how to specify FolderB/ErrorHandler.cpp in CMakeLists.txt using CMAKE_CURRENT_SOURCE_DIR. Do I need to set PROJECT_SOURCE_DIR to the parent folder of A and B? The *_SOURCE_DIR and *_BINARY_DIR variables are read-only, never try to set them. Alex ___ 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] Newbie questions: verbosity and compiler invocation
Hi Michael The makefile I am replacing uses VPATH to specify a source file that must be compiled for the target. That source file is in a different directory to the one containing CMakeLists.txt. How can I achieve this with CMake please? Best regards David ___ 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] Newbie questions: verbosity and compiler invocation
Hi Michael With CMake you can use absolute and relative paths, no problem. If you use absolute paths, please use one of the pre-defined variables, such as ${CMAKE_SOURCE_DIR}, ${CMAKE_BINARY_DIR}, ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_SOURCE_DIR}, ${PROJECT_BINARY_DIR}, ${project_name_SOURCE_DIR} or ${project_name_BINARY_DIR}. Thanks. My situation is: -- FolderA --- CMakeLists.txt | |- FolderB --- ErrorHandler.cpp As FolderB is not beneath FolderA, I don't know how to specify FolderB/ErrorHandler.cpp in CMakeLists.txt using CMAKE_CURRENT_SOURCE_DIR. Do I need to set PROJECT_SOURCE_DIR to the parent folder of A and B? Can you suggest how I can do this please? Best regards David ___ 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] Newbie questions: verbosity and compiler invocation
Hi Michael Are they _always_ next to each other and is FolderB always called by that name? Yes If so, just do ${CMAKE_PROJECT_DIR}/../FolderB. Thanks that worked fine. I wasn't aware of that syntax possibility. David ___ 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] Newbie questions: verbosity and compiler invocation
On 9. Sep, 2010, at 15:37 , David Aldrich wrote: Hi Michael Are they _always_ next to each other and is FolderB always called by that name? Yes If so, just do ${CMAKE_PROJECT_DIR}/../FolderB. Thanks that worked fine. I wasn't aware of that syntax possibility. David There's not much CMake syntax involved here. CMake expands ${CMAKE_PROJECT_DIR} to the absolute path of the directory containing the top-level CMakeLists.txt file, and then the rest is just normal path specification. Michael -- There is always a well-known solution to every human problem -- neat, plausible, and wrong. H. L. Mencken PGP.sig Description: This is a digitally signed message part ___ 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] Newbie questions: verbosity and compiler invocation
On 8. Sep, 2010, at 16:33 , David Aldrich wrote: Hi I am experimenting with using CMake to replace our manually written gnu makefiles on Linux. I have a couple of questions: 1) VERBOSITY I would like to see the compiler command on the console when running make. I know that one can run: make VERBOSE=1 but that displays a lot of detail, for example: make[1]: Entering directory ... Is there a way that I reduce the commentary to just show the compiler commands? For example: /usr/bin/c++ -o CMakeFiles/Kernel.dir/ErrorHandler.cpp.o -c /mypath/Kernel/ErrorHandler.cpp AFAIK there's no way to do that (apart from writing a wrapper script which echoes the command to stdout and then invokes it). 2) COMPILER As shown above, cmake is invoking: /usr/bin/c++ I don't know what this tool is. How can I specify to use /usr/bin/g++ ? Best regards David The first time you invoke CMake, do it like this: CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake /path/to/source Alternatively, you can pass -DCMAKE_C_COMPILER=/usr/bin/gcc to the cmake program (similarly CMAKE_CXX_COMPILER for the c++ compiler), but that can have some nasty side-effects (e.g deleting and rebuilding the whole cache if it already exists). Usually, on Linux systems, /usr/bin/c++ is just another name for /usr/bin/g++. It is traditional to call the default C++ compiler /usr/bin/c++, such that hand-crafted Makefiles don't have to guess a name. Similarly, /usr/bin/cc is the default C compiler. Hope this clears things up a bit for you Michael -- There is always a well-known solution to every human problem -- neat, plausible, and wrong. H. L. Mencken PGP.sig Description: This is a digitally signed message part ___ 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] Newbie questions: verbosity and compiler invocation
Hi Michael Thanks for your answers. One other thing was worrying me. Currently, if a user changes our manually written makefile and checks it into svn, other users can do an svn update and then invoke make to construct a new build. If we move to cmake, users would modify and commit CMakeLists.txt. I was worried that they would then need to run cmake followed by make. They might forget to do both. But it seems that 'make' compares the timestamp of the generated makefile against that of CMakeLists.txt and rebuilds the makefile if it is older. Therefore, the developer would not need to run cmake, just 'make'. Am I correct? I guess the only new action in the workflow would be that a complete cmake command must be invoked on a freshly checked out working copy, if the build tree is in that working copy. Am I correct? Thanks David -Original Message- From: Michael Wild [mailto:them...@gmail.com] Sent: 08 September 2010 15:56 To: David Aldrich Cc: CMake@cmake.org Subject: Re: [CMake] Newbie questions: verbosity and compiler invocation On 8. Sep, 2010, at 16:33 , David Aldrich wrote: Hi I am experimenting with using CMake to replace our manually written gnu makefiles on Linux. I have a couple of questions: 1) VERBOSITY I would like to see the compiler command on the console when running make. I know that one can run: make VERBOSE=1 but that displays a lot of detail, for example: make[1]: Entering directory ... Is there a way that I reduce the commentary to just show the compiler commands? For example: /usr/bin/c++ -o CMakeFiles/Kernel.dir/ErrorHandler.cpp.o -c /mypath/Kernel/ErrorHandler.cpp AFAIK there's no way to do that (apart from writing a wrapper script which echoes the command to stdout and then invokes it). 2) COMPILER As shown above, cmake is invoking: /usr/bin/c++ I don't know what this tool is. How can I specify to use /usr/bin/g++ ? Best regards David The first time you invoke CMake, do it like this: CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake /path/to/source Alternatively, you can pass -DCMAKE_C_COMPILER=/usr/bin/gcc to the cmake program (similarly CMAKE_CXX_COMPILER for the c++ compiler), but that can have some nasty side-effects (e.g deleting and rebuilding the whole cache if it already exists). Usually, on Linux systems, /usr/bin/c++ is just another name for /usr/bin/g++. It is traditional to call the default C++ compiler /usr/bin/c++, such that hand-crafted Makefiles don't have to guess a name. Similarly, /usr/bin/cc is the default C compiler. Hope this clears things up a bit for you Michael -- There is always a well-known solution to every human problem -- neat, plausible, and wrong. H. L. Mencken ___ 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] Newbie questions: verbosity and compiler invocation
Hi David Yes, this is correct. And before you even get the idea: Never add the CMake-generated files (Makefile, CMakeCache.txt, etc.) to your version control system. They are not relocatable. Michael On 8. Sep, 2010, at 17:23 , David Aldrich wrote: Hi Michael Thanks for your answers. One other thing was worrying me. Currently, if a user changes our manually written makefile and checks it into svn, other users can do an svn update and then invoke make to construct a new build. If we move to cmake, users would modify and commit CMakeLists.txt. I was worried that they would then need to run cmake followed by make. They might forget to do both. But it seems that 'make' compares the timestamp of the generated makefile against that of CMakeLists.txt and rebuilds the makefile if it is older. Therefore, the developer would not need to run cmake, just 'make'. Am I correct? I guess the only new action in the workflow would be that a complete cmake command must be invoked on a freshly checked out working copy, if the build tree is in that working copy. Am I correct? Thanks David -Original Message- From: Michael Wild [mailto:them...@gmail.com] Sent: 08 September 2010 15:56 To: David Aldrich Cc: CMake@cmake.org Subject: Re: [CMake] Newbie questions: verbosity and compiler invocation On 8. Sep, 2010, at 16:33 , David Aldrich wrote: Hi I am experimenting with using CMake to replace our manually written gnu makefiles on Linux. I have a couple of questions: 1) VERBOSITY I would like to see the compiler command on the console when running make. I know that one can run: make VERBOSE=1 but that displays a lot of detail, for example: make[1]: Entering directory ... Is there a way that I reduce the commentary to just show the compiler commands? For example: /usr/bin/c++ -o CMakeFiles/Kernel.dir/ErrorHandler.cpp.o -c /mypath/Kernel/ErrorHandler.cpp AFAIK there's no way to do that (apart from writing a wrapper script which echoes the command to stdout and then invokes it). 2) COMPILER As shown above, cmake is invoking: /usr/bin/c++ I don't know what this tool is. How can I specify to use /usr/bin/g++ ? Best regards David The first time you invoke CMake, do it like this: CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake /path/to/source Alternatively, you can pass -DCMAKE_C_COMPILER=/usr/bin/gcc to the cmake program (similarly CMAKE_CXX_COMPILER for the c++ compiler), but that can have some nasty side-effects (e.g deleting and rebuilding the whole cache if it already exists). Usually, on Linux systems, /usr/bin/c++ is just another name for /usr/bin/g++. It is traditional to call the default C++ compiler /usr/bin/c++, such that hand-crafted Makefiles don't have to guess a name. Similarly, /usr/bin/cc is the default C compiler. Hope this clears things up a bit for you Michael -- There is always a well-known solution to every human problem -- neat, plausible, and wrong. H. L. Mencken -- There is always a well-known solution to every human problem -- neat, plausible, and wrong. H. L. Mencken PGP.sig Description: This is a digitally signed message part ___ 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] Newbie questions: verbosity and compiler invocation
Hi Michael Yes, this is correct. Thanks. And before you even get the idea: Never add the CMake-generated files (Makefile, CMakeCache.txt, etc.) to your version control system. They are not relocatable. Ah yes. You told me that before ;-) I will take your advice! David ___ 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