Spicy | 1 Jan 2010 01:57
Picon

cmake 2.6: add_custom_command - add_custom_target

Hi cmakers,

I decided to start a new project using cmake. While I got a lot of
things going quickly, some things are taking me to despair. The current
issue has a couple of web hits, but either I misunderstand something
critical or cmake 2.6 (as of current Debian Lenny) is broken:

--8<-------CMakeLists.txt------------
cmake_minimum_required(VERSION 2.6)
project(test)
add_custom_command(
  OUTPUT bla.txt
  COMMAND touch bla.txt
  )
add_custom_target(bla DEPENDS bla.txt)
--8<-------CMakeLists.txt------------

I'd expect this to produce an effective Makefile like this:
.phony: bla
bla: bla.txt
bla.txt:
    touch bla.txt

Well, cmake Makefiles are somewhat more complicated, but it essentially
misses the final rule, i.e. typing

#~: make bla
make[3]: *** Keine Regel vorhanden, um das Target »../bla.txt«,
  benötigt von »CMakeFiles/bla«, zu erstellen.  Schluss.
make[2]: *** [CMakeFiles/bla.dir/all] Fehler 2
(Continue reading)

Alan W. Irwin | 1 Jan 2010 07:32
Picon
Picon

Re: cmake 2.6: add_custom_command - add_custom_target

On 2010-01-01 01:57+0100 Spicy wrote:

> Hi cmakers,
>
> I decided to start a new project using cmake. While I got a lot of
> things going quickly, some things are taking me to despair. The current
> issue has a couple of web hits, but either I misunderstand something
> critical or cmake 2.6 (as of current Debian Lenny) is broken:
>
> --8<-------CMakeLists.txt------------
> cmake_minimum_required(VERSION 2.6)
> project(test)
> add_custom_command(
> OUTPUT bla.txt
> COMMAND touch bla.txt
> )
> add_custom_target(bla DEPENDS bla.txt)
> --8<-------CMakeLists.txt------------

> Any ideas what is going wrong here?

Yes.  replace bla.txt everywhere by ${CMAKE_CURRENT_BINARY_DIR}/bla.txt, and
all will be well. I have just checked that works, and also verified the
problem you found if you use bla.txt instead.

It's possible you might be able to also solve the problem using
WORKING_DIRECTORY, but I am not sure about that, and I know
${CMAKE_CURRENT_BINARY_DIR}/bla.txt (i.e., being specific about the
path) always does work.

(Continue reading)

Spicy | 1 Jan 2010 13:15
Picon

Re: cmake 2.6: add_custom_command - add_custom_target

Thanks a lot Alan,

this solved the issue and also my original problem concerning the pot 
target.

 > Yes.  replace bla.txt everywhere by ${CMAKE_CURRENT_BINARY_DIR}/bla.txt,

It is sufficient to specify the path for add_custom_target, i.e.

--8<-------CMakeLists.txt------------
cmake_minimum_required(VERSION 2.6)
project(test)
add_custom_command(
   OUTPUT bla.txt
   COMMAND touch bla.txt
)
add_custom_target(bla DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/bla.txt)
--8<-------CMakeLists.txt------------

And then it's also clear why this is required. The OUTPUT is created in 
the build tree, while DEPENDS are expected in the source tree.

Many thanks and a happy new year,
  - lars.
_______________________________________________
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
(Continue reading)

Hicham Mouline | 1 Jan 2010 16:00

TARGET_LINK_DIRECTORIES, ADD_SUBDIRECTORY, winpaths and vs2008

Hello,

 

I branch this question out of another post that I posted earlier.

My top-level cmakelists.txt :

ADD_SUBDIRECTORY(lib3)

 

In the source tree, the lib3 directory includes a CMakeListst.xt:

ADD_LIBRARY(lib3 …..)

FILE(TO_CMAKE_PATH "C:\\Program Files (x86)\\Qt\\4.6.0\\lib\\QtCored4.lib" MY_QTCORELIB)

MESSAGE(STATUS "MY_QTCORELIB=${MY_QTCORELIB}")

TARGET_LINK_LIBRARIES(lib3 ${MY_QTCORELIB})

 

I expect the lib3.vcproj to include the QtCored4.lib, or in the IDE to appear in Librarian/General/Additional Dependencies.

 

But it doesn’t,

 

Happy new year!

_______________________________________________
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
Clinton Stimpson | 1 Jan 2010 16:51

Re: TARGET_LINK_DIRECTORIES, ADD_SUBDIRECTORY, winpaths and vs2008

On 01/01/2010 08:00 AM, Hicham Mouline wrote:

Hello,

 

I branch this question out of another post that I posted earlier.

My top-level cmakelists.txt :

ADD_SUBDIRECTORY(lib3)

 

In the source tree, the lib3 directory includes a CMakeListst.xt:

ADD_LIBRARY(lib3 …..)

FILE(TO_CMAKE_PATH "C:\\Program Files (x86)\\Qt\\4.6.0\\lib\\QtCored4.lib" MY_QTCORELIB)

MESSAGE(STATUS "MY_QTCORELIB=${MY_QTCORELIB}")

TARGET_LINK_LIBRARIES(lib3 ${MY_QTCORELIB})

 

I expect the lib3.vcproj to include the QtCored4.lib, or in the IDE to appear in Librarian/General/Additional Dependencies.

 

But it doesn’t,


Because its a static library, and static libraries don't link against other libraries.
But you did tell CMake that lib3 depends on Qt, so when lib3 is linked into an executable, you'll see the Qt libraries linked then too.

Clint

_______________________________________________
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
Pau Garcia i Quiles | 1 Jan 2010 23:37
Favicon

ANN: CModuler

Hello,

CModuler is a CMake module generator. I was fed up with copy & paste,
search & replace over and over again 90% of the time.

Version 1.0 (AKA "CModuler Meta") provides only very limited
functionality: it will create finders (modules of the form
FindXXX.cmake) for libraries consisting of only 1 library.
CModuler-generated modules support debug/release configurations.

See http://gitorious.org/cmoduler/cmoduler/blobs/master/example/FindSqlite3.cmake
for an example of a CModuler-generated module.

You can download CModuler from http://gitorious.org/cmoduler

CModuler is licensed under the same BSD license CMake is.

--

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
_______________________________________________
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

C. Meissa | 2 Jan 2010 13:37
Picon
Picon

cmake clean

Hello list,

is there a make or cmake target which cleans all cmake generated files?
(e.g. folder CMakeFiles, cmake_install.make, …)

Would be nice not to be forced doing this manually…

Thanks in advance
C.M.
_______________________________________________
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
Pau Garcia i Quiles | 2 Jan 2010 14:34
Favicon

Re: cmake clean

On Sat, Jan 2, 2010 at 1:37 PM, C. Meissa <carsten.meissa@...> wrote:
> Hello list,
>
> is there a make or cmake target which cleans all cmake generated files?
> (e.g. folder CMakeFiles, cmake_install.make, …)
>
> Would be nice not to be forced doing this manually…

No, there is not. Just use an out-of-source build.

http://www.cmake.org/Wiki/CMake_FAQ#CMake_does_not_generate_a_.22make_distclean.22_target._Why.3F
http://www.cmake.org/Wiki/CMake_FAQ#Running_.22make_clean.22_does_not_remove_custom_command_outputs._Why.3F

--

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
_______________________________________________
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

C. Meissa | 2 Jan 2010 15:51
Picon
Picon

Re: cmake clean

Hi,

Am Samstag, 2. Januar 2010 schrieb Pau Garcia i Quiles:
> No, there is not. Just use an out-of-source build.

Great help.
Thanks a lot!

C.M.
_______________________________________________
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

Guilherme Balena Versiani | 2 Jan 2010 18:47
Picon
Gravatar

Re: [PATCH] FindRuby.cmake does not support version 1.9.1

Yes, the attached patch corrects both problems.

--
Guilherme Balena Versiani.


2009/12/30 Alexander Neundorf <a.neundorf-work-hi6Y0CQ0nG0@public.gmane.org>
On Tuesday 29 December 2009, Guilherme Balena Versiani wrote:
> Hello all,
>
> FindRuby.cmake from CMake 2.8.0 does not support Ruby 1.9.1, and has some
> errors on variable RUBY_NODOT_VERSION (it wasn't created resulting in
> _nothing_ in expansions). It follows attached a patch to be applied to
> solve these BUGs.

Does the attached patch also fix the problems ?

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

Gmane