I'm having some problems try to link two shared library to my main.cpp file in a cmake file.
My folder tree is:
- mainfolder= main.cpp and CMakeLists.txt
- mainfolder/lib1 = lib1.cpp - lib1.h - cmakelists.txt - the generated liblib1.so
- mainfolder/lib2 = lib2.cpp - lib2.h - cmakelists.txt - the generated, liblib2.so
my main.cpp file is:
#include <stdio.h>
#include <stdlib.h>
#include <opencv2/opencv.hpp>
#include "lib/lib1/lib1.h"
#include "lib/lib2/lib2.h"
using namespace cv;
int main()
{
printf("Executing main.cpp");
lib1 lib1object;
lib2 lib2object;
for(;;)
{
lib1object.Analize(param1, param2);
lib2object.Draw(param1, param2, param3);
}
return 0;
}
My main.cpp should call openCV + the two libraries. Could you please tell me which line I have to add to the CMakeLists.txt in the main folder to run my main?
in this moment the CMakeLists.txt is:
cmake_minimum_required(VERSION 2.8)
project( MyProject C CXX )
find_package( OpenCV REQUIRED )
add_executable( main main.cpp )
target_link_libraries( main ${OpenCV_LIBS})
I really appreciate your help. Thanks!!
Aucun commentaire:
Enregistrer un commentaire