mercredi 24 février 2016

Cmake: Error loading function, subdirectory dependencies

I'm entirely new to cmake and none of the similar questions on stack overflow have seemed to help with my issue.

I have several small components which can act as standalone applications and another one which uses several of these small components.

My directory structure looks like this: project-dir ----face-detect ----full-preprocessing

The project in full-preprocessing uses face-detect as a component.

in project-dir I have a CMakeLists.txt with:

cmake_minimum_required(VERSION 2.8)
add_subdirectory(face-detect)
add_subdirectory(full-preprocessing)

in face-detect I have a CMakeLists.txt with:

cmake_minimum_required(VERSION 2.8)
add_compile_options(-std=c++11)
project(face_detect)
find_package(OpenCV REQUIRED)

set(face_detect_source_files face_detect.cpp face_detect.hpp)
add_library(face_detect_lib STATIC ${face_detect_source_files})

add_executable(face_detect run_face_detect.cpp face_detect.cpp)
target_link_libraries(face_detect ${OpenCV_LIBS})

Then in full-preprocessing I have a CMakeLists.txt with:

cmake_minimum_required(VERSION 2.8)
add_compile_options(-std=c++11)
project(full_preprocessing)
find_package(OpenCV REQUIRED)

add_executable(full_preprocessing full_preprocessing.cpp)
target_link_libraries(full_preprocessing ${OpenCV_LIBS})
target_link_libraries(full_preprocessing face_detect_lib)

All of the OpenCV parts definitely work and face-detect works as a standalone application (with a separate file for main). But when I run full_preprocessing I get the message "--(!)Error Loading" when the function in face-detect is called. Any clues?

Aucun commentaire:

Enregistrer un commentaire