Issue
I have a problem with Conan and Cmake:
With conan i'm downloading my libraries and i want to compile with Cmake, here is my CMakeLists.txt :
cmake_minimum_required(VERSION 3.16)
project(BABEL)
set(CMAKE_CXX_STANDARD 20)
set(PROJECT_NAME BABEL)
set(SOURCES qt/main.cpp)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
conan_basic_setup(KEEP_RPATHS)
if (APPLE)
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
endif (APPLE)
file(WRITE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf [Paths]\nPrefix=${CONAN_QT_ROOT})
add_executable(${PROJECT_NAME} ${SOURCES})
find_package(portaudio REQUIRED)
find_package(opus REQUIRED)
find_package(Qt5 COMPONENTS Widgets Network Core Gui REQUIRED)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
target_link_libraries(${PROJECT_NAME} opus)
if (WIN32)
target_link_libraries(${PROJECT_NAME} portaudio_x64)
else()
target_link_libraries(${PROJECT_NAME} portaudio)
endif()
if I write this command :
mkdir build && cd build && conan install .. && cmake .. -G "Unix Makefiles" && cmake --build.
I'll have to write cmake --build . a second time for the binary to be built, any idea of what i did wrong here ?
edit Here is the result of the build :
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/laurent/Documents/Delivery/Tek3/CPP/B-CPP-500-LYN-5-1-babel-kevin.melinon/build
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /Users/laurent/Documents/Delivery/Tek3/CPP/B-CPP-500-LYN-5-1-babel-kevin.melinon/build
-- Conan: Using autogenerated Findportaudio.cmake
-- Library portaudio found /Users/laurent/.conan/data/portaudio/19.7.0/bincrafters/stable/package/22e8f592c814313580425adf77089996d9853e39/lib/libportaudio.dylib
-- Found: /Users/laurent/.conan/data/portaudio/19.7.0/bincrafters/stable/package/22e8f592c814313580425adf77089996d9853e39/lib/libportaudio.dylib
-- Conan: Using autogenerated FindOpus.cmake
CMake Warning (dev) at /usr/local/Cellar/cmake/3.21.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (Opus) does
not match the name of the calling package (opus). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
build/Findopus.cmake:81 (find_package_handle_standard_args)
CMakeLists.txt:24 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
I can't put the full result.
Solution
So apparently there is a bug when writing all the command in one, typing them one by one solved the problem.
Answered By - Diamonddedo Answer Checked By - Willingham (WPSolving Volunteer)