FLTK logo

[fltk/fltk] Cannot build project with CMake (add_library cannot create ALIAS target "fltk" because target "fltk::fltk" is imported but not globally visible) (Issue #970)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

[fltk/fltk] Cannot build project with CMake (add_library cannot create ALIAS target "fltk" because target "fltk::fltk" is imported but not globally visible) (Issue #970) Alejandro Suárez 05:54 May 07  
 

Describe the bug

When setting up a CMake project that uses FLTK, the following error messages pop up during the CMake configuration process:

CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:96 (add_library):
  add_library cannot create ALIAS target "fltk" because target "fltk::fltk"
  is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:105 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:96 (add_library):
  add_library cannot create ALIAS target "fltk-shared" because target
  "fltk::fltk-shared" is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:106 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:94 (add_executable):
  add_executable cannot create ALIAS target "fluid" because target
  "fltk::fluid" is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:108 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:94 (add_executable):
  add_executable cannot create ALIAS target "fltk-options" because target
  "fltk::options" is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:111 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:96 (add_library):
  add_library cannot create ALIAS target "fltk_forms" because target
  "fltk::forms" is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:115 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:96 (add_library):
  add_library cannot create ALIAS target "fltk_forms-shared" because target
  "fltk::forms-shared" is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:116 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:96 (add_library):
  add_library cannot create ALIAS target "fltk_gl" because target "fltk::gl"
  is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:115 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:96 (add_library):
  add_library cannot create ALIAS target "fltk_gl-shared" because target
  "fltk::gl-shared" is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:116 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:96 (add_library):
  add_library cannot create ALIAS target "fltk_images" because target
  "fltk::images" is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:115 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)


CMake Error at /home/asuarez/.local/share/fltk/FLTKConfig.cmake:96 (add_library):
  add_library cannot create ALIAS target "fltk_images-shared" because target
  "fltk::images-shared" is imported but not globally visible.
Call Stack (most recent call first):
  /home/asuarez/.local/share/fltk/FLTKConfig.cmake:116 (_fltk_make_alias)
  CMakeLists.txt:16 (find_package)

I have to disable (comment out) lines 87 to 119 from the FLTKConfig.cmake file in order for CMake to succeed.

To Reproduce

I've followed the instructions from README.CMake.txt to build FLTK and set up the project. Here you'll find a FLTK project that used to work with the pre-release of FLTK v1.4 (like a year ago) and no longer works (unless I comment out lines 87 to 119 from FLTKConfig.cmake). I've adapted the project to the new changes described in README.CMake.txt (e.g. linking the executables to fltk::fltk-shared instead of fltk_SHARED).

Expected behavior

Successful configuration and compilation of the project.

Screenshots

N/A

FLTK Version

  • Version: 1.4.0
  • Installed from source using CMake.
  • Downloaded and self-built from: FLTK Git repo: https://github.com/fltk/fltk
  • If from Git, branch: master
  • If from Git, commit: 2af1da4

FLTK Configure / Build Options

Procedure for building:

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:=$HOME/.local -DFLTK_BUILD_SHARED_LIBS:=ON -DCMAKE_BUILD_TYPE:=RELEASE
make -j6 install

The example project is built like so:

(create and cd to build)
cmake .. -DFLTK_DIR:=$HOME/.local
make -j6

Operating System / Platform:

Please be as precise as possible, e.g. "Linux: Ubuntu 20.04"

  • OS: Ubuntu 20.04
  • CMake version: 3.16.3

Linux/Unix Runtime, if applicable:

N/A

Additional context

N/A


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/issues/970@github.com>

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.