From the following example:
CMakeList.txt file:
include_directories(inc)
# Grab all the cpp and h files to be compile.
file(GLOB SOURCES
inc/*.h
inc/*.hpp
src/*.cpp
)
add_library(MyStaticLib STATIC ${SOURCES} )
target_link_libraries(MyStaticLib PUBLIC "${OPENCV_LIBS}/opencv_world410.lib" )
target_link_libraries(MyStaticLib PUBLIC "${OPENCV_LIBS}/opencv_world410d.lib" )
Does this create a single static library? I thought you could not link a static library to a static library in c++? Why does this work? Also, what would be the best way to do this? For example, if I create an API that is a static Lib i.e., MyStaticLib and it’s dependent on opencv’s Static lib, what would be the best way to set this up in CMake?
Thanks all. Sincerely, Frank from Old-School.