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

Cannot specify link libraries for target "yaml-cpp" #1277

Open
ahzahzahz opened this issue Apr 11, 2024 · 1 comment
Open

Cannot specify link libraries for target "yaml-cpp" #1277

ahzahzahz opened this issue Apr 11, 2024 · 1 comment

Comments

@ahzahzahz
Copy link

when I build my project

            CMake Error at /usr/local/lib/cmake/yaml-cpp/yaml-cpp-config.cmake:49 (target_link_libraries):
              Cannot specify link libraries for target "yaml-cpp" which is not built by
              this project.
            Call Stack (most recent call first):
              CMakeLists.txt:19 (find_package)
            
            
            -- Configuring incomplete, errors occurred!
            See also "/home/yumin/apriltag_detect_zhouke_refine/build/CMakeFiles/CMakeOutput.log"
@ljluestc
Copy link


cmake_minimum_required(VERSION 3.10)
project(apriltag_detect_zhouke_refine)

# Set C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Find the yaml-cpp package
find_package(yaml-cpp REQUIRED)

# Add your executable (replace main.cpp with your actual source file(s))
add_executable(${PROJECT_NAME} main.cpp)

# Link yaml-cpp to your executable
target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp)

# Optional: Include directories if needed (usually not necessary with modern yaml-cpp)
# target_include_directories(${PROJECT_NAME} PRIVATE ${YAML_CPP_INCLUDE_DIR})

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