[CMake] cmake_policy(VERSION 2.4) = no exe's generated

Eric Noulard eric.noulard at gmail.com
Sat Jan 30 06:44:11 EST 2010


2010/1/29 Frank Bonniwell <valefar4 at gmail.com>:
> Hello All,
>
> I'm a student new to cmake and I ran into a stump with compiling some code.
>
> When I apply the cmake_policy as instructed in a previous compiling error,
> no executables are generated even when the output says otherwise.

Did you try

make VERBOSE=1

> -- Generating done
> -- Build files have been written to: /home/mdtom/mpp/
> build
>
> Line from CMakeList.txt
>
> # avoid warning with CMake 2.6
> cmake_policy(VERSION 2.4)
> add_executable(test
>   main.cc
>   testwin.cc
>   testwin.h
>   cairovol.cc
>   cairovol.h
>   )
>
>
> When I also try to apply CMP0003 before the add_executable, no executables
> are generated.
>
>     if(COMMAND cmake_policy)
>       cmake_policy(SET CMP0003 NEW)
>     endif(COMMAND cmake_policy)
>
>
> Is there a better approach to using the cmake_policy I may have overlooked?

If you are beginning to use CMake why do you have such an older policy
as of CMake 2.4?

I would at least recommend:
cmake_minimum_required(VERSION 2.6.0)
then keep reading...

>  This warning appears
>   because target "test" links to some libraries for which the linker must
>   search:
>
>     gtkmm-2.4, giomm-2.4, gdkmm-2.4, atkmm-1.6, gtk-x11-2.0, pangomm-1.4
>     cairomm-1.0, glibmm-2.4, sigc-2.0, gdk-x11-2.0, atk-1.0, pangoft2-1.0
>     gdk_pixbuf-2.0, m, pangocairo-1.0, gio-2.0, cairo, pango-1.0, freetype
[...]

Your CMakeLists.txt excerpt is too small
it did not show us
the find_package
and target_link_libraries part which may help us to help you.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list