Re: [CMake] newbie q - where do I put what in which CMakeLists file? out of source build
On Wednesday 09 March 2011 13:09:39 Michael Hertling wrote: > Could you boil down your project to a minimal but complete example > which demonstrates the issues with the header not being found and > the files not being placed properly and post it here? Here's an example of it compiling correctly, but making a package wrong: minimal.tar.gz . -bash-4.1$ cd build -bash-4.1$ cmake ../src -- The C compiler identification is GNU -- The CXX compiler identification is GNU -bash-4.1$ make Scanning dependencies of target readmidi [100%] Building CXX object CMakeFiles/readmidi.dir/midi.o Linking CXX executable readmidi [100%] Built target readmidi -bash-4.1$ ./readmidi Header, 6 bytes Track, 19 bytes Track, 655 bytes Track, 675 bytes Track, 1491 bytes Track, 1334 bytes -bash-4.1$ make package_source bash-4.1$ cd /tmp -bash-4.1$ tar xvzf ~/minimal/build/minimal-0.1.1-Source.tar.gz x minimal-0.1.1-Source/config.h.in x minimal-0.1.1-Source/midi.h x minimal-0.1.1-Source/CMakeLists.txt~ x minimal-0.1.1-Source/midi.cpp x minimal-0.1.1-Source/CMakeLists.txt x minimal-0.1.1-Source/midi.cpp~ For minimal2, follow the same steps except start with "cmake ..". The program doesn't compile; the package is rooted correctly, but contains contents of the build directory as well as the src directory. Pierre -- Jews use a lunisolar calendar; Muslims use a solely lunar calendar. minimal.tar.gz Description: application/tgz minimal2.tar.gz Description: application/tgz ___ 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 q - where do I put what in which CMakeLists file? out of source build
On Wednesday 09 March 2011 10:22:50 Michael Wild wrote: > Make the ~/tone12/CMakeLists.txt your main CMake file (i.e. put the > project() command in there and all other commands that apply to the > whole project) and add a "add_subdirectory(src)" call, and then call > CMake with "cmake .." instead. Doesn't work. config.h is in ~/tone12/build as before, but it says it can't find it, and with VERBOSE=1 it appears to be compiling the file into ~/tone12/src/, which shouldn't exist. The package contains everything in ~/tone12/build and lots of temporary files, which shouldn't be in a package. Pierre -- li ze te'a ci vu'u ci bi'e te'a mu du li ci su'i ze te'a mu bi'e vu'u ci ___ 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 q - where do I put what in which CMakeLists file? out of source build
On Wednesday 09 March 2011 05:19:42 Johannes Zarl wrote: > > configure_file(src/config.h.in config.h) > > In CMake, use of relative filenames is (mostly) discouraged. A robust > way to do this would be to write: > > configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in > ${CMAKE_CURRENT_BINARY_DIRECTORY}/include/config.h ) > > include_directories( ${CMAKE_CURRENT_BINARY_DIRECTORY}/include ) I got it to work, typing "cmake ../src" and leaving ~/tone12/CMakeLists.txt empty. "INCLUDE_DIRECTORIES" has to be in all caps (at least I didn't see it add -I when I had it in lowercase) and it's CMAKE_CURRENT_BINARY_DIR (with ...DIRECTORY it tried to write to /include). I ran "make package_source" and get a tarball containing the following: -rw-r--r-- 0 phma phma 2460 Mar 9 15:07 tone12-0.1.1-Source/riffwave.cpp -rw-r--r-- 0 phma phma 65 Mar 9 15:07 tone12-0.1.1-Source/config.h.in -rw-r--r-- 0 phma phma 2316 Mar 9 15:07 tone12-0.1.1-Source/midi.h -rw-r--r-- 0 phma phma 384 Mar 9 15:07 tone12-0.1.1-Source/CMakeLists.txt~ -rw-r--r-- 0 phma phma 2303 Mar 9 15:07 tone12-0.1.1-Source/midi.cpp -rw-r--r-- 0 phma phma 384 Mar 9 15:07 tone12-0.1.1-Source/CMakeLists.txt -rw-r--r-- 0 phma phma10551 Mar 9 15:07 tone12-0.1.1-Source/tonegen.cpp -rw-r--r-- 0 phma phma14625 Mar 9 15:07 tone12-0.1.1-Source/tone12.cpp~ -rw-r--r-- 0 phma phma 2322 Mar 9 15:07 tone12-0.1.1-Source/midi.h~ -rw-r--r-- 0 phma phma14625 Mar 9 15:07 tone12-0.1.1-Source/tone12.cpp -rw-r--r-- 0 phma phma 1455 Mar 9 15:07 tone12-0.1.1-Source/riffwave.h -rw-r--r-- 0 phma phma 4339 Mar 9 15:07 tone12-0.1.1-Source/tonegen.h Those should be tone12-0.1.1-Source/src/midi.h etc. How can I fix this? Pierre -- I believe in Yellow when I'm in Sweden and in Black when I'm in Wales. ___ 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] newbie q - where do I put what in which CMakeLists file? out of source build
I have a program called "tone12" which I was working on in KDevelop 3, then copied to my DragonFly box which has KDev 4. Finding out that KDev4 no longer has support for autotools, I created an empty project, copied the files, and got it to compile. Then I added a big-endian test (I just added a MIDI parsing routine, and some numbers are written in MIDI files with a specified endianness). CMake looks easy enough to manage without an IDE, and the KDev I have isn't developed enough. So I'd like to make a tree that looks like this: ~/tone12: CMakeLists.txt src/ build/ README INSTALL LICENSE ~/tone12/src: CMakeLists.txt config.h.in midi.h riffwave.h tonegen.cpp midi.cpp riffwave.cpp tone12.cpp tonegen.h ~/tone12/build: (object files and executable go here) (also some midi files for the program to read) I'd like it to make a tarball package consisting of the listed files in tone12 and tone12/src, but not the config.h or the midi files. My CMakeLists files are currently as follows: ~/tone12/CMakeLists.txt: project(tone12) add_subdirectory(src) INCLUDE(CPack) INCLUDE(TestBigEndian) TEST_BIG_ENDIAN(BIGENDIAN) configure_file(src/config.h.in config.h) ~/tone12/src/CMakeLists.txt: add_executable(tone12 tone12.cpp midi.cpp midi.h riffwave.cpp riffwave.cpp tonegen.cpp tonegen.h) configure_file(config.h.in config.h) The result is that config.h goes in ~/tone12/build/src, where make can't find it. I don't want build/src, just build. How do I fix it? Pierre -- li ze te'a ci vu'u ci bi'e te'a mu du li ci su'i ze te'a mu bi'e vu'u ci ___ 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