gz-cmake icon indicating copy to clipboard operation
gz-cmake copied to clipboard

IGNITION_CMAKE_VERSION_MAJOR changes after finding packages that use newer version of ign-cmake

Open osrf-migration opened this issue 5 years ago • 13 comments

Original report (archived issue) by Brian Marchi (Bitbucket: BEMarchi).

The original report had attachments: CMakeLists.txt, example.cc


Prerequisites

* [X] Put an X between the brackets on this line if you have done all of the following:
* Checked the QA board for common solutions: http://answers.gazebosim.org
* Checked that your issue isn't already filed.
* Checked that there is not already an Ignition package that provides the described functionality: https://ignitionrobotics.org/libs

Description

When trying to use a package that links against cmake2 and another one that links against cmake1, I get the following:

CMake Error at CMakeLists.txt:13 (add_library):
Target example links to target ignition-cmake1::utilities; but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?

Steps to Reproduce

1. Clone ign-cmake1
2. Clone ign-cmake2
3. Clone ign-common3
4. Clone ign-math6
5. Clone ign-msgs2 branch https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-msgs/pull-requests/138/use-math6
6. Clone ign-transport5
7. Create a project with a CMakeLists.txt like this:

cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(example_project LANGUAGES C CXX VERSION 3.0.0)
find_package(ignition-common3 REQUIRED COMPONENTS graphics)
find_package(ignition-math6 REQUIRED)
find_package(ignition-msgs2 REQUIRED)
find_package(ignition-transport5 REQUIRED COMPONENTS log)

add_library(example
  example.cc)
target_link_libraries(example
    ignition-common3::ignition-common3
    ignition-transport5::core
    ignition-transport5::log
    ignition-msgs2::ignition-msgs2)
install(TARGETS example
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

8. Create an empty example.cc file living in the same dir as the above CMakeLists.txt

9. Build and install all projects

Expected behavior:

Library example should build normally

Actual behavior:

Library example doesn’t build

Reproduces how often:

Always

Versions

ign-cmake2, ign-cmake1, ign-transport5, ign-msgs2 branch msgs2_use_math6, ign-common3.
OS: Ubuntu 18.04

osrf-migration avatar Jul 04 '19 15:07 osrf-migration