[CMake] newbie q - where do I put what in which CMakeLists file? out of source build

Pierre Abbat phma at phma.optus.nu
Wed Mar 9 10:14:50 EST 2011


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   phma    10551 Mar  9 15:07 
tone12-0.1.1-Source/tonegen.cpp
-rw-r--r--  0 phma   phma    14625 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   phma    14625 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.


More information about the CMake mailing list