[CMake] Using modules, adjusting CMAKE_MODULE_PATH

Thomas Lehmann t.lehmann at rtsgroup.net
Tue Nov 2 09:46:58 EDT 2010


I have not changed anything in the source tree
and the current folder for the build tree is
empty before I start calling cmake.

The build is working fine (by the way) but this
warning disturbs.

CMP0011: Included scripts do automatic cmake_policy PUSH and POP.

I'm not sure what I should do now.
I have created a simple macro only including this in a project.

FindAllOptions.cmake:
cmake_minimum_required(VERSION 2.6)

macro(requires_lib target sources binaries)
    if (TARGET ${target})
        link_directories(${CMAKE_CURRENT_SOURCE_DIR}/${sources}/${target}
                         ${CMAKE_BINARY_DIR}/${binaries}/${target})
    else  (TARGET ${target})
        add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${sources}/${target}
                         ${CMAKE_BINARY_DIR}/${binaries}/${target})
    endif (TARGET ${target})
endmacro(requires_lib)

Used here in a CMakeLists.txt:
# ensuring that packages are found
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
                      ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules)

# most common options, macros, ... required by most projects
find_package(AllOptions)

project(app2)

# defining include dependencies:
include_directories( ../../libs/one
                     ../../libs/two)

requires_lib(one ../../libs libs)
requires_lib(two ../../libs libs)

# all sources of current folder are required for this application:
file(GLOB sources *.cxx)

# defining the build target with the found sources:
add_executable(app2 ${sources})

# linking libraries to the application:
target_link_libraries(app2 one two)


>

Thomas Lehmann
Scrum Master

RTS Realtime Systems Software GmbH, Rembrandtstrasse 13, D-60596 Frankfurt am Main
T: +49.69.61009.0 / F: +49.69.61009.181

Sitz: Frankfurt am Main - HRB 84467 Amtsgericht Frankfurt am Main
Gesch?ftsf?hrer: Steffen Gemuenden, Igor Sluga

www.rtsgroup.net

This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify me immediately by return email and promptly delete this message and its attachments from your computer system.
-----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
> Of Rolf Eike Beer
> Sent: Dienstag, 2. November 2010 14:01
> To: cmake at cmake.org
> Subject: Re: [CMake] Using modules, adjusting CMAKE_MODULE_PATH
>
> > Hi all,
> >
> > your solution is working fine but I got this message:
> >
> > CMake Error: The source
> > "F:/Checkouts/prototyping/cmake_sandbox/CMakeLists.txt" does not match
> the
> > source "F:/Checkouts/prototyping/cmake_sandbox/rtd/CMakeLists.txt"
> used to
> > generate cache.  Re-run cmake with a different source directory.
> >
> > f:\Checkouts\prototyping\cmake_sandbox\obj>cmake ../rtd
> > CMake Warning (dev) at app2/CMakeLists.txt:6 (find_package):
> >   Policy CMP0011 is not set: Included scripts do automatic
> cmake_policy
> > PUSH
> >   and POP.  Run "cmake --help-policy CMP0011" for policy details.  Use
> the
> >   cmake_policy command to set the policy and suppress this warning.
> >
> >   The included script
> >
> >
> F:/Checkouts/prototyping/cmake_sandbox/cmake/modules/FindAllOptions.cmak
> e
> >
> >   affects policy settings.  CMake is implying the NO_POLICY_SCOPE
> option
> > for
> >   compatibility, so the effects are applied to the including context.
> > This warning is for project developers.  Use -Wno-dev to suppress it.
> >
> > -- Configuring done
> > -- Generating done
> > -- Build files have been written to:
> > F:/Checkouts/prototyping/cmake_sandbox/obj
>
> You try to reuse a CMake build try. That will never work. Once you have
> configured a build tree the source directory (the location, not the
> contents) must not change. Use multiple build trees.
>
> Eike
> _______________________________________________
> 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


More information about the CMake mailing list