Re: [CMake] CMake C++/ADA
Hi Romain, I must do a project for my university. This project is composed of three part, one in C, one in Ada and one C++(Qt for Ui) First of all it is possible to use these three languages in one project. I am doing it here for at least one year. If you want to do an intermixing of these three languages, then there could be a problem. If you are using Ada only for generating executables then you will use gnatmake as it done in Alan's given examples. But when you are using Ada language for generating DLLs or SO, then sometimes you have to call the gnatbind on the generated ali files on your own. Because if you don't do that, there will be no __elab part and no adainit/adafinialize part (second one could be written explicit in your source code too). I would like to know how i have to write my CMakelists.txt. If you have some example of CMakeLists.txt, or ideas for solve my problem of language compatibility. The written CMakeLists.txt don't differ much to example files as you can find them at the cmake site. For Ada language support you can use the files given by Alan's former post. These helped me for starting. Hope to help so far. Feel free to ask more questions Greetings Alexander ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Getting Makefiles sensitive to new/deleted files/directories?
Many of my CMakeLists.txt files has code like this: FILE(GLOB SRC *.cpp *.c) ADD_LIBRARY(my_lib ${SRC}) My users occasionally get tripped up because after someone adds a new .cpp file, the other users forget to rerun cmake before running make. Has anyone considered enhancing CMake so that when the set of source files picked up by a FILE(GLOB ...) command changes, cmake is automatically re-run? Even if a new command had to be added, or a new option to the FILE(...) command, that would be fine. But this is probably the main problem I'm seeing my users encounter with our CMake-based build system. I'd be very happy if we could eliminate it. Christian Convey Scientist, Naval Undersea Warfare Centers Newport, RI ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Getting Makefiles sensitive to new/deleted files/directories?
Convey Christian J NPRI wrote: Many of my CMakeLists.txt files has code like this: FILE(GLOB SRC *.cpp *.c) ADD_LIBRARY(my_lib ${SRC}) My users occasionally get tripped up because after someone adds a new .cpp file, the other users forget to rerun cmake before running make. Has anyone considered enhancing CMake so that when the set of source files picked up by a FILE(GLOB ...) command changes, cmake is automatically re-run? Even if a new command had to be added, or a new option to the FILE(...) command, that would be fine. But this is probably the main problem I'm seeing my users encounter with our CMake-based build system. I'd be very happy if we could eliminate it. Really this is not a recommended way of setting up a cmake project. I suppose this could be done when cmake check build system is done. It would slow down the cmake check because it would have to do the glob each time the build system is run. It would not be trivial to implement. Also, this kind of thing can cause trouble if you put temp files in your source directory that happen to match. Is it really that hard to list all the files you want to build? -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Batch converting several files
Andy, thanks for the tutorial. It does exactly what I need. I copied and modified the relevant pieces and it worked as expected on the first run. Thanks Martin On 18.03.2008 18:27 Andy Lego wrote: I wrote a quick tutorial (tested on Linux and Windows) for what you want to do: http://www.cmake.org/Wiki/CMake:How_To_Process_Lots_Of_Input_Files Please let me know if this solves your problem. On Tue, Mar 18, 2008 at 12:15 AM, Martin Fischer [EMAIL PROTECTED] wrote: Andy, yes the ( is missing in my message. This happened when editing the post. Both () are there in my CMakeLists file. Anyway, thanks for your assistance. I give up and will hardcode the necessary commands. I prefer to work on the project instead of learning CMake details. Regards Martin On 17.03.2008 22:26 Andy Lego wrote: You are missing a ( after the ADD_CUSTOM_COMMAND. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Batch converting several files
Hi Martin, Happy I could help. Just make sure to rerun CMake when you add new input files. Andy On Wed, Mar 19, 2008 at 12:10 PM, Martin Fischer [EMAIL PROTECTED] wrote: Andy, thanks for the tutorial. It does exactly what I need. I copied and modified the relevant pieces and it worked as expected on the first run. Thanks Martin On 18.03.2008 18:27 Andy Lego wrote: I wrote a quick tutorial (tested on Linux and Windows) for what you want to do: http://www.cmake.org/Wiki/CMake:How_To_Process_Lots_Of_Input_Files Please let me know if this solves your problem. On Tue, Mar 18, 2008 at 12:15 AM, Martin Fischer [EMAIL PROTECTED] wrote: Andy, yes the ( is missing in my message. This happened when editing the post. Both () are there in my CMakeLists file. Anyway, thanks for your assistance. I give up and will hardcode the necessary commands. I prefer to work on the project instead of learning CMake details. Regards Martin On 17.03.2008 22:26 Andy Lego wrote: You are missing a ( after the ADD_CUSTOM_COMMAND. -- http://legoandy.com -o- http://capitalmtb.org Support my 150 mile bike ride to fight MS: http://bikecan.nationalmssociety.org/site/TR?px=3921627pg=personalfr_id=9066 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Getting Makefiles sensitive tonew/deleted files/directories?
Can you do the glob, configure the result out to a file, then INCLUDE that file. I believe that will solve the problem. Something like file(GLOB SRC *.cpp) configure_file(somefile.in somefile) include(somefile) where somefile.in looks like # list of files as a comment -- ${SRC} This works because CMake does check (at make time) to see if any included file in CMake has changed but is smart in that configure_file only writes the file if it has changed. I'm pretty sure something like that will work. Ken Ken Martin PhD Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Hoffman Sent: Wednesday, March 19, 2008 10:13 AM To: Convey Christian J NPRI Cc: cmake@cmake.org Subject: Re: [CMake] Getting Makefiles sensitive tonew/deleted files/directories? Convey Christian J NPRI wrote: Many of my CMakeLists.txt files has code like this: FILE(GLOB SRC *.cpp *.c) ADD_LIBRARY(my_lib ${SRC}) My users occasionally get tripped up because after someone adds a new .cpp file, the other users forget to rerun cmake before running make. Has anyone considered enhancing CMake so that when the set of source files picked up by a FILE(GLOB ...) command changes, cmake is automatically re-run? Even if a new command had to be added, or a new option to the FILE(...) command, that would be fine. But this is probably the main problem I'm seeing my users encounter with our CMake-based build system. I'd be very happy if we could eliminate it. Really this is not a recommended way of setting up a cmake project. I suppose this could be done when cmake check build system is done. It would slow down the cmake check because it would have to do the glob each time the build system is run. It would not be trivial to implement. Also, this kind of thing can cause trouble if you put temp files in your source directory that happen to match. Is it really that hard to list all the files you want to build? -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Getting Makefiles sensitive tonew/deleted files/directories?
On 03/19/2008 09:50 PM, Ken Martin wrote: Can you do the glob, configure the result out to a file, then INCLUDE that file. I believe that will solve the problem. Something like file(GLOB SRC *.cpp) configure_file(somefile.in somefile) include(somefile) where somefile.in looks like # list of files as a comment -- ${SRC} This works because CMake does check (at make time) to see if any included file in CMake has changed but is smart in that configure_file only writes the file if it has changed. I'm pretty sure something like that will work. Ken Could you be a bit more specific on how to include a file with listed source files or actually in which format such a file has to be? I tried that but it didn't work for me. Alex was suggesting this solution a while back where packadal was asking about build shared library from static libraries: You have to set them in the parent directory or set them ibn a file in the subdir which is then INCLUDE()d in the parent directory (use full paths then) ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] INCLUDE_DIRECTORIES and FIND_PATH
Hi! FIND_PATH(GN NAMES include PATHS /tmp ) I see I am using this wrong, my apologies. Thanks, George. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
[CMake] Sun GCC builds (cooltools)
Hi CMakers, I am building cmake on a Sun Enterprise 220R with 2GB of RAM running Solaris 10 08/07. I have two compilers installed on this box. 1. SunStudio 12 -bash-3.00$ /opt/SUNWspro/bin/CC -V CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25 2. The SUN modified gcc compiler v4.2.0 -- http://cooltools.sunsource.net/gcc sparc-sun-solaris2.10-gcc (GCC) 4.2.0 (gccfss) Copyright (C) 2007 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. When compiling with #1, bootstrap / make ... worked and all tests passed for both in-source and out-of-source bootstrap builds. When compiling with #2, an in-source ./bootstrap fails with the following error export CC=/opt/gcc/bin/gcc export CXX=/opt/gcc/bin/g++ cvs co CMake cd CMake ./bootstrap . . Undefined first referenced symbol in file cmELF::GetSOName(std::basic_stringchar, std::char_traitschar, std::allocatorchar )cmSystemTools.o cmELF::GetRPath() cmSystemTools.o cmELF::cmELF(char const*) cmSystemTools.o cmELF::Valid() constcmSystemTools.o cmELF::GetRunPath() cmSystemTools.o cmELF::~cmELF() cmSystemTools.o ld: fatal: Symbol referencing errors. No output written to cmake however an out-of-source bootstrap appears to succeed, cvs co CMake mkdir CMake.build cd CMake.build ../CMake/bootstrap ... but make then fails with, [ 31%] Building C object Utilities/cmcurl/CMakeFiles/cmcurl.dir/strdup.o [ 31%] Building C object Utilities/cmcurl/CMakeFiles/cmcurl.dir/strequal.o [ 31%] Building C object Utilities/cmcurl/CMakeFiles/cmcurl.dir/strerror.o /export/home/gneill/src/CMake/Utilities/cmcurl/strerror.c:28:2: error: #error you MUST have either POSIX or glibc strerror_r if strerror_r is found /export/home/gneill/src/CMake/Utilities/cmcurl/strerror.c: In function 'Curl_strerror': /export/home/gneill/src/CMake/Utilities/cmcurl/strerror.c:649: warning: initialization makes pointer from integer without a cast *** Error code 1 I am willing to set up nightly builds on this machine and report results to the cmake dashboard ... if you are interested. Thanks, George. ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] embed version numbers in libraries (.so, a) and executables
On Mon, Mar 17, 2008 at 7:54 PM, Ittay Dror [EMAIL PROTECTED] wrote: Hi, Does cmake have support for embedding version numbers in libraries and executables? Specifically: * generate a string with the library / executable name, containing the version What do you want to do? Aside from support for the VERSION and SOVERSION target properties on shared libraries (see SET_TARGET_PROPERTIES command) there's really not much for CMake to do here, I think. You can of course use a CMake variable that defines the version of the library/executable that you're building and do whatever you want with it. Some possibilities might be ADD_DEFINITIONS() to define a version number as a preprocessor definition, SET_TARGET_PROPERTIES() on targets to change their names or set versions, tweaking the behavior of the INSTALL() command, etc. * allow nightly builds to add build number * add checksum (sha1) to uniquely identify a the library / executable based on its source files and compilation flags If you're looking to get the revision of your current checkout repository you could use ADD_CUSTOM_TARGET() to extract the relevant information assuming that your CM system has support for revision numbers. Below is one way you can pull the revision number out of subversion (for example) using the svnversion command and use it within your source code (I'm sure someone on here has a cleaner / more platform independent way of doing this). This may be overkill for your needs, it depends on if you need the build number to be available everytime you type make or if you just need it at CMake configuration time. The latter is far easier to do via EXECUTE_PROCESS(). In general, CMake does a good job providing the ADD_CUSTOM_COMMAND() and ADD_CUSTOM_TARGET() to allow you to do custom things during your build. You could use the ADD_CUSTOM_COMMAND() with the POST_BUILD option for generating a sha1sum, for example. CMakeLists.txt: = CONFIGURE_FILE(dump_svnversion.sh.in dump_svnversion.sh) ADD_CUSTOM_TARGET(OutputSvnVersion ALL ${CMAKE_CURRENT_BINARY_DIR}/dump_svnversion.sh) # allow including the current_svnversion.h file which in this example is generated in the binary directory INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/current_svnversion.h PROPERTIES GENERATED true) ADD_EXECUTABLE(foo foo.cc ${CMAKE_CURRENT_BINARY_DIR}/current_svnversion.h) dump_svnversion.sh.in: = #!/bin/sh [EMAIL PROTECTED]@/svnversion_tmp echo #ifndef @[EMAIL PROTECTED] $FILE echo #define @[EMAIL PROTECTED] $FILE echo #define @[EMAIL PROTECTED] \`svnversion @[EMAIL PROTECTED] $FILE echo #endif $FILE @CMAKE_COMMAND@ -E copy_if_different @CMAKE_CURRENT_BINARY_DIR@/svnversion_tmp @CMAKE_CURRENT_BINARY_DIR@/current_svnversion.h -- Philip Lowman ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake