Joined November 2013
·

nicolas

lille
·
·

Hi, Nice post.
I use a different way to achieve this goal.
My tips is to write a single CMakeList.txt for my dependency. That CMakelist.txt only calls cmake / cmake --build on itself with a -DINSTALLPREFIX used later by findlibrary and a -DINSTALLING=TRUE, when INSTALLING is TRUE, it defines a single project with an ExternalProject_Add and a specified install prefix.

That CMakeList looks something like this :
```
if(NOT INSTALLING)
set(WORKING DIRECTORY "${CMAKECURRENTBINARYDIR}/Install")
file(MAKE
DIRECTORY "${DIRECTORY}"")
executeprocess(
COMMAND "${CMAKE
COMMAND}" -DINSTALLING=TRUE -DINSTALLPREFIX=${MYINSTALLPREFIX} "${CMAKECURRENTSOURCEDIR}"
WORKING_DIRECTORY "${DIRECTORY}"
)

executeprocess(
COMMAND "${CMAKE
COMMAND}" --build . --config Release
WORKING_DIRECTORY "${DIRECTORY}"

)
else()

project("<external_project>")

include(ExternalProject)

ExternalProjectAdd(
external
project
GITREPOSITORY "<gitrepourl>"
INSTALL
DIR "${INSTALLPREFIX}"
CMAKE
ARGS -DCMAKEINSTALLPREFIX:PATH=<INSTALL_DIR>
)
endif()
```

Achievements
1 Karma
0 Total ProTip Views
Interests & Skills