Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#79 CMake reports an error when using External Modules

closed-fixed
General (20)
5
2011-11-02
2011-11-02
Rui Silva
No

I use External Modules in YARP configured using <YARP_ROOT>/conf/ExternalModules.cmake.

I have multiple external modules, and when I generate a solution for Visual Studio, CMake returns this error:

CMake Warning (dev) at src/modules/CMakeLists.txt:62 (add_subdirectory):
Policy CMP0013 is not set: Duplicate binary directories are not allowed.
Run "cmake --help-policy CMP0013" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.

The binary directory

<YARP_ROOT>/src/modules/externals

is already used to build a source directory. This command uses it to build
source directory

<EXTERNAL_MODULES_DIR>/my_module_2

which can generate conflicting build files. CMake does not support this
use case but it used to work accidentally and is being allowed for
compatibility.
This warning is for project developers. Use -Wno-dev to suppress it.

I looked into <YARP_ROOT>/src/modules/CMakeLists.txt : 62 and replaced it with:

add_subdirectory(${safe_path}
${CMAKE_CURRENT_BINARY_DIR}/externals/${EXT_DIR})

It seems to me that CMake is putting all external modules into the same directory, and this workaround solved my problem.

Is this a bug?

Discussion

  • Thanks for reporting this. Yes, this is a bug (that used to work accidentally, as the cmake message says). Thanks for figuring out a solution. Committed (with ${EXTDIR} rather than ${EXT_DIR}, right?), with changelog acknowledgement. If you get a change to confirm that YARP trunk now works for you, that would be very useful.

     
  • Rui Silva
    Rui Silva
    2011-11-02

    You're right, it's ${EXTDIR} and not ${EXT_DIR}, my mistake.

    I just compiled YARP trunk with this latest change and it works for me.

     
  • Thanks, closing bug.

     
    • assigned_to: nobody --> eshuy
    • status: open --> closed-fixed