Compiling errors and using Cmake Set Policy

This is a discussion on Compiling errors and using Cmake Set Policy within the Linux Programming forums, part of the Platform Specific Boards category; Compiling errors and using Cmake Set Policy -------------------------------------------------------------------------------- Hello, I'm new to the world of compiling in Linux and I ...

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Compiling errors and using Cmake Set Policy

    Compiling errors and using Cmake Set Policy

    --------------------------------------------------------------------------------

    Hello,

    I'm new to the world of compiling in Linux and I thought this is the best place to ask questions!

    I discovered the project I'm trying to compile has two add_executable targets that share the same name in two different folders. Both of these add_executable targets are in two separate CMakeList.txt files.

    for example

    /home/mdtom//icap/core/CMakeList.txt

    /home/mdtom//icap/gui/CMakeList.txt


    When compiling in Ubuntu jaunty 9.04 with cmake 2.6, it has the new cmake_policy parameters to help programmers.

    The --help-policy CMP0002 suggested I use the OUTPUT_NAME property but I get entirely new errors when trying the following"



    Code:

    Code:
    #/home/programmer/toolb/icap/core/CMakeList.txt
    
    ADD_EXECUTABLE(test_f1 test.cpp)
    SET_TARGET_PROPERTIES(test_f1 OUTPUT_NAME test)
    
     #/home/programmer/toolb/icap/gui/CMakeList.txt
    
    ADD_EXECUTABLE(test_f2 main.cpp)
    SET_TARGET_PROPERTIES(test_f2 OUTPUT_NAME test)
    Is there a better approach to eliminating the error or am I on the right path?
    I'm open to any suggestions.

    Below is the output from the cmake.

    Thanks,

    E


    mdtom@ubuntu:~/icap/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
    CMake Warning (dev) at gui/CMakeLists.txt:12 (add_executable):
    Policy CMP0002 is not set: Logical target names must be globally unique.
    Run "cmake --help-policy CMP0002" for policy details. Use the cmake_policy
    command to set the policy and suppress this warning.
    This warning is for project developers. Use -Wno-dev to suppress it.

    -- Configuring done
    CMake Warning (dev) at core/CMakeLists.txt:25 (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:

    Magick++, MagickCore

    and other libraries with known full path:

    /home/mdtom//icap/core/libcore.a
    /home/mdtom//icap/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/icap/build
    mdtom@ubuntu:~/icap/build$

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,499
    Never heard of it.

    I might suggest you start at the source and work your way out through the various link paths until you find the answer.

    There are 1000's of things which run on Linux, so don't pick a "Linux" forum to being with, start with the application you're running.

    Also here
    Compiling errors and using Cmake Set Policy - Linux Forums
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    Post your original CMakeLists.txt file. I have a script I wrote to auto-gen projects in CMake so if I need to do a fast "what-if" project I can cd to an empty folder, run this script, answer a small handful of questions and get a full CMake project, complete with skeletal C++ reflecting the answers to the questions that compiles and runs (without your errors); IOW a complete running project that I can start hanging code off of to do <whatever> in about 10 seconds. Let's see what your CMake stuff looks like...sounds like you are trying to use OUTPUT_NAME variable w/o treating it like one but I cannot be sure..
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21