YY shinidaye
YY shinidaye

Reputation: 1

I use Cmake to make project, but it called error when generating : Target "xxxxxxx" links to: igl::core , but the target was not found

Configuring done
CMake Error at CMakeLists.txt:5 (target_link_libraries):
  Target "101_GlyphRendering_bin" links to:

    igl::core

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.16)
project(101_GlyphRendering)

add_executable(${PROJECT_NAME}_bin main.cpp)
target_link_libraries(${PROJECT_NAME}_bin PUBLIC igl::core igl::glfw igl::opengl tutorials)

I opened the project and built it, an error occurred:

C1083 Cannot open include file:'directional/directional_viewer.h':No such file or dictory

enter image description here

Upvotes: -1

Views: 300

Answers (1)

Mikhail
Mikhail

Reputation: 68

I'm not sure what exactly is your problem, but speaking of

C1083 Cannot open include file:'directional/directional_viewer.h':No such file or directory

If you want to manually link libraries, you need to also include headers from that libraries. To do such, use

target_include_directories(<target> PUBLIC <include_folder_dir>)

where <target> is your ${PROJECT_NAME}_bin and <include_folder_dir> is folder with headers of library you are linking to.

Upvotes: 1

Related Questions