W
W
warchant2016-04-06 16:59:12
C++ / C#
warchant, 2016-04-06 16:59:12

How to make find_package cmake modules visible?

I install the SOFA framework , built it with cmake according to their instructions, everything is fine. It consists of several modules: SofaFramework, SofaGui, etc.
I'm trying to write a dummy plugin for it, below is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.12)
project(Warchant)

set(HEADER_FILES
    MyHeader1.h
)

set(SOURCE_FILES
    MySource1.cpp
)

find_package(SofaGui REQUIRED) # где он ищет его?

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} SofaCore)

By the way, in build there is a cmake folder with SofaFrameworkConfig.cmake files , etc.
I build the plugin from
/root/sofa/v15.12/src/build/applications/plugins/Warchant/build

An error is displayed on such CMakeLists:

Could not find a package configuration file provided by "SofaGui" with any
of the following names:
SofaGuiConfig.cmake
sofagui-config.cmake
Add the installation prefix of "SofaGui" to CMAKE_PREFIX_PATH or set
"SofaGui_DIR" to a directory containing one of the above files. If
"SofaGui" provides a separate development package or SDK, be sure it has
been installed.

Googled, advised to add the line:
list(APPEND CMAKE_PREFIX_PATH "/root/sofa/v15.12/src/build/")

Now he says this:

CMake Error at /root/sofa/v15.12/src/build/cmake/SofaFrameworkConfig.cmake:80 (include):
include could not find load file:
/root/sofa/v15.12/src/build/cmake/SofaFrameworkTargets .cmake
Call Stack (most recent call first):
/root/sofa/v15.12/src/build/cmake/SofaSimulationConfig.cmake:29 (find_package)
/root/sofa/v15.12/src/build/cmake/SofaBaseConfig .cmake:29 (find_package)
/root/sofa/v15.12/src/build/cmake/SofaCommonConfig.cmake:29 (find_package)
/root/sofa/v15.12/src/build/cmake/SofaGeneralConfig.cmake:29 (find_package)
/root/sofa/v15.12/src/build/cmake/SofaGuiConfig.cmake:29 (find_package)
CMakeLists.txt:30 (find_package)

And so for each *.cmake file inside build/cmake/. Each file contains
find_package(SofaFramework REQUIRED) # либо другой модуль

That is, find_package cannot find these modules. How do I make all these modules visible to find_package ? Do I have to manually edit each *.cmake file and prescribe the paths it needs?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Vasilyevich, 2016-04-06
@mariczzz

Try this find_package option
( SofaGui
PATHS /root/sofa/v15.12/src/build/cmake
REQUIRED
)
See find_package for details

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question