Ask Your Question

Revision history [back]

CMake option to prefer static libs

Hello all,

I am using OpenCV 3.4.3 on macOS 10.14 for one of my projects. While I have installed and compiled OpenCV myself, I'd like to build an executable with statically linked OpenCV libs so my colleagues don't all have to go through this procedure themselves. Since I have both the shared .dylibs and static .a file, I was wondering, if there is some CMake option to pass, so that find_package will prefer the static libraries. For boost, there is such an option "set(Boost_USE_STATIC_LIBS ON)". I have found some mentions of OpenCV_STATIC/SHARED online but none seem to work. Otherwise, I'd have to manually specify the path to the files, which I find a lot less elegant and less portable.

Any ideas are appreciated. Thank you

click to hide/show revision 2
retagged

updated 2018-10-13 05:58:50 -0600

berak gravatar image

CMake option to prefer static libs

Hello all,

I am using OpenCV 3.4.3 on macOS 10.14 for one of my projects. While I have installed and compiled OpenCV myself, I'd like to build an executable with statically linked OpenCV libs so my colleagues don't all have to go through this procedure themselves. Since I have both the shared .dylibs and static .a file, I was wondering, if there is some CMake option to pass, so that find_package will prefer the static libraries. For boost, there is such an option "set(Boost_USE_STATIC_LIBS ON)". I have found some mentions of OpenCV_STATIC/SHARED online but none seem to work. Otherwise, I'd have to manually specify the path to the files, which I find a lot less elegant and less portable.

Any ideas are appreciated. Thank you

click to hide/show revision 3
retagged

updated 2018-10-13 05:58:51 -0600

berak gravatar image

CMake option to prefer static libs

Hello all,

I am using OpenCV 3.4.3 on macOS 10.14 for one of my projects. While I have installed and compiled OpenCV myself, I'd like to build an executable with statically linked OpenCV libs so my colleagues don't all have to go through this procedure themselves. Since I have both the shared .dylibs and static .a file, I was wondering, if there is some CMake option to pass, so that find_package will prefer the static libraries. For boost, there is such an option "set(Boost_USE_STATIC_LIBS ON)". I have found some mentions of OpenCV_STATIC/SHARED online but none seem to work. Otherwise, I'd have to manually specify the path to the files, which I find a lot less elegant and less portable.

Any ideas are appreciated. Thank you