Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example build cmake warnings #93

Open
cevich opened this issue Aug 30, 2014 · 5 comments
Open

example build cmake warnings #93

cevich opened this issue Aug 30, 2014 · 5 comments

Comments

@cevich
Copy link

cevich commented Aug 30, 2014

Under Fedora 21 beta, using Fedora 20 toolchain (bugzilla 1134394), CMake 2.8.12 gives the following warnings:

$ mkdir build && cd build && cmake ..
...cut...
-- Configuring done
CMake Warning (dev) at cmake/Platform/Arduino.cmake:983 (add_library):
  Policy CMP0038 is not set: Targets may not link directly to themselves.
  Run "cmake --help-policy CMP0038" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Target "uno_example" links to itself.
Call Stack (most recent call first):
  cmake/Platform/Arduino.cmake:1040 (setup_arduino_library)
  cmake/Platform/Arduino.cmake:391 (setup_arduino_libraries)
  example/CMakeLists.txt:73 (generate_arduino_library)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in example/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "uno_example" has an INTERFACE_LINK_LIBRARIES property.  This should
  be preferred as the source of the link interface for this library but
  because CMP0022 is not set CMake is ignoring the property and using the
  link implementation as the link interface instead.

  INTERFACE_LINK_LIBRARIES:

    uno_CORE;uno_example

  Link implementation:

    uno_CORE

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Platform/Arduino.cmake:983 (add_library):
  Policy CMP0038 is not set: Targets may not link directly to themselves.
  Run "cmake --help-policy CMP0038" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Target "uno_example" links to itself.
Call Stack (most recent call first):
  cmake/Platform/Arduino.cmake:1040 (setup_arduino_library)
  cmake/Platform/Arduino.cmake:391 (setup_arduino_libraries)
  example/CMakeLists.txt:73 (generate_arduino_library)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Platform/Arduino.cmake:983 (add_library):
  Policy CMP0038 is not set: Targets may not link directly to themselves.
  Run "cmake --help-policy CMP0038" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Target "diecimila_Wire" links to itself.
Call Stack (most recent call first):
  cmake/Platform/Arduino.cmake:1040 (setup_arduino_library)
  cmake/Platform/Arduino.cmake:626 (setup_arduino_libraries)
  example/CMakeLists.txt:12 (generate_arduino_example)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Platform/Arduino.cmake:983 (add_library):
  Policy CMP0038 is not set: Targets may not link directly to themselves.
  Run "cmake --help-policy CMP0038" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Target "uno_example" links to itself.
Call Stack (most recent call first):
  cmake/Platform/Arduino.cmake:1040 (setup_arduino_library)
  cmake/Platform/Arduino.cmake:391 (setup_arduino_libraries)
  example/CMakeLists.txt:73 (generate_arduino_library)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/Platform/Arduino.cmake:983 (add_library):
  Policy CMP0038 is not set: Targets may not link directly to themselves.
  Run "cmake --help-policy CMP0038" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Target "diecimila_Wire" links to itself.
Call Stack (most recent call first):
  cmake/Platform/Arduino.cmake:1040 (setup_arduino_library)
  cmake/Platform/Arduino.cmake:626 (setup_arduino_libraries)
  example/CMakeLists.txt:12 (generate_arduino_example)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in example/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "diecimila_Wire" has an INTERFACE_LINK_LIBRARIES property.  This
  should be preferred as the source of the link interface for this library
  but because CMP0022 is not set CMake is ignoring the property and using the
  link implementation as the link interface instead.

  INTERFACE_LINK_LIBRARIES:

    diecimila_CORE;diecimila_Wire

  Link implementation:

    diecimila_CORE

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /tmp/arduino-cmake/build
@cevich
Copy link
Author

cevich commented Aug 30, 2014

Looking at the suggested policy details, CMP0022 seems to suggest a fix which will also be compatible with older cmake versions (re: cmake/Platform/Arduino.cmake line 983):

Warning-free future-compatible code which works with CMake 2.8.9 onwards
can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords
of ``target_link_libraries()``.

However, I'm not enough of a cmake guru to know what this means, or how to fix it 😢

@cevich
Copy link
Author

cevich commented Aug 30, 2014

Just by total guessing and some poking around, I found this makes all the warnings go away (though I don't know if it is a correct fix, or will work with older versions of cmake):

diff --git a/cmake/Platform/Arduino.cmake b/cmake/Platform/Arduino.cmake
index 22ba5d8..d42a7ec 100644
--- a/cmake/Platform/Arduino.cmake
+++ b/cmake/Platform/Arduino.cmake
@@ -1001,7 +1001,7 @@ function(setup_arduino_library VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLA
                 LINK_FLAGS "${ARDUINO_LINK_FLAGS} ${LINK_FLAGS}")
             list(APPEND LIB_INCLUDES "-I\"${LIB_PATH}\" -I\"${LIB_PATH}/utility\"")

-            target_link_libraries(${TARGET_LIB_NAME} ${BOARD_ID}_CORE ${LIB_TARGETS})
+            target_link_libraries(${TARGET_LIB_NAME} ${BOARD_ID}_CORE)
             list(APPEND LIB_TARGETS ${TARGET_LIB_NAME})

         endif()

It does end the complaining, and all the examples seem to build fine as well.

@cevich
Copy link
Author

cevich commented Aug 30, 2014

Here's a pull-request with this change if by chance I guessed correctly (please double-check): #94

@jorihardman
Copy link

Bump. Anyone ever figure out what's going on with these?

@cevich
Copy link
Author

cevich commented Dec 16, 2014

Dunno, but I've been running with #94 applied and it seems to address the issue. But again, I'm not a CMAKE expert, just know enough to be dangerous 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants