I am a newbie with clion and I want to compile my project.
If I compile it in the console: g++ -o a main.cpp -std=c++11 pkg-config opencv --cflags --libs -lboost_system
... it works fine.
When I add it to Cmake/Cache --> CMAKE_CXX_FLAGS, it will be parsed to "pkg-config opencv --cflags --libs" what is not wanted.
Can somebody help me?
1. From the command line
You could set CMAKE_CXX_FLAGS:
export CMAKE_CXX_FLAGS=`pkg-config opencv --cflags --libs` (notice the back ticks)
2. Inside the CMakeLists.txt file/your cmake file:
If you are using OpenCV 2.4 or later, then you could do it using just:
FIND_PACKAGE( OpenCV REQUIRED core highgui imgproc)
Other way would be:
find_package(PkgConfig REQUIRED)
pkg_search_module(OpenCV REQUIRED core highgui imgproc)
(Add/subtract other OpenCV modules too as required by your project)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With