I've built and make install
ed opencv on my mac with SHARED_LIBS.
What do I need to do in order to be able to build with static linking so that I can build standalone apps which on other computers. I want to be able to choose between a built with or without shared libs.
I assume I have to recompile OpenCV with -DBUILD_SHARED_LIBS=OFF
but I don't know what I have to do in cmake to make it work. I have the source in my ~/opencv
and I've already compiled it in ~/opencv/build
followed by make install
.
Can I create another dir like ~/opencv/static_build
and compile with the relevant flag? Do I need to make install
as well? And how do I reference the specific opencv build in cmake? I suppose the cmake variables in
find_package( OpenCV REQUIRED )
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(test ${OpenCV_LIBS} "-static")
are all defined when make install
is invoked. Is that correct?