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

Frank Bonniwell valefar4 at gmail.com
Fri Jan 29 17:02:22 EST 2010


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.


-- 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?

Thanks,

-F



Output from shell:


mdtom at ubuntu:~/
mpp/build$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- checking for module 'ImageMagick++'
--   found ImageMagick++, version 6.4.5
-- checking for module 'gtkmm-2.4>=2.10'
--   found gtkmm-2.4, version 2.16.0
-- checking for module 'cairomm-1.0'
--   found cairomm-1.0, version 1.6.4
-- checking for module 'gthread-2.0'
--   found gthread-2.0, version 2.20.1
-- Configuring done
CMake Warning (dev) at gui/CMakeLists.txt:12 (add_executable):
  Policy CMP0003 should be set before this line.  Add code such as

    if(COMMAND cmake_policy)
      cmake_policy(SET CMP0003 NEW)
    endif(COMMAND cmake_policy)

  as early as possible but after the most recent call to
  cmake_minimum_required or cmake_policy(VERSION).  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
    fontconfig, gobject-2.0, gmodule-2.0, glib-2.0, cairomm-1.0, cairo
    Magick++, MagickCore, gthread-2.0, rt, glib-2.0, 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, fontconfig
    gobject-2.0, gmodule-2.0, Magick++, MagickCore, gthread-2.0, rt

  and other libraries with known full path:

    mdtom/mpp/build/core/libcore.a
    mdtom/mpp/build/ext/newmat/libnewmat.a

  CMake is adding directories in the second list to the linker search path
in
  case they are needed to find libraries from the first list (for backwards
  compatibility with CMake 2.4).  Set policy CMP0003 to OLD or NEW to enable
  or disable this behavior explicitly.  Run "cmake --help-policy CMP0003"
for
  more information.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /home/mdtom/mpp/build
mdtom at ubuntu:~/mpp/build$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100129/bb1a20ad/attachment-0001.htm>


More information about the CMake mailing list