Answer the question
In order to leave comments, you need to log in
How to format a cmake file correctly?
I want to use the libssh library , but when building the project, the linker sees only undefined functions.
CMake is configured correctly (I hope), in any case, it finds the library, but the functions are still a problem.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.18.4)
project(c)
set(CMAKE_CXX_STANDART 17)
file(GLOB
CPPS "*.cpp")
find_package(LIBSSH)
if(NOT LIBSSH_FOUND)
message(SEND_ERROR "Libssh was not found")
return()
else()
message("FIND")
include_directories(${LIBSSH_INCLUDE_DIR})
endif()
add_executable(${PROJECT_NAME} ${CPPS})
target_link_libraries(c ${libssh_LIBRARY})
#include<libssh/libssh.h>
int main()
{
ssh_session my_ssh_session = ssh_new();
if (my_ssh_session == NULL){
return 1;
}
ssh_free(my_ssh_session);
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question