0

We have an external project we want to fetch using cmake using ExternalProject_add.
Let's say the external project has a structure:

External_Project
├── myClass.hpp
├── myClass.cpp
├── userOfClass.hpp
├── userOfClass.cpp

We're fetching External_Project using the following:

ExternalProject_add(get_rtpm
PREFIX "${EXTERNAL_PROJECT_PREFIX_DIRECTORY}/my_external_project"
SVN_REPOSITORY "${ZE_MIRROR}/${EXTERNAL_PROJECT_SVN_PATH}" --no-auth-cache
SVN_TRUST_CERT 1
SVN_USERNAME "zeUsername"
SVN_PASSWORD "zePassword"

UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
BUILD_IN_SOURCE 1
INSTALL_COMMAND cmake -E copy_directory . ${FINAL_LOCATION_DIR}
)

After this we want to move the fetched external project to another location. So we use

INSTALL_COMMAND cmake -E copy_directory . ${FINAL_LOCATION_DIR}<br>

as seen above.

The files in final location after the INSTALL_COMMAND ends up being:

Final_Location_Dir
├── External_Project
│   ├──myClass.hpp
│   ├── userOfClass.hpp
│   ├── userOfClass.cpp

"myClass.cpp" is missing. Why??

The command includes "copy_directory" but this just one file that's being left out.

RAM
  • 2,257
  • 2
  • 19
  • 41
  • Are you sure that `myClass.cpp` does *actually* reside in the source directory, from which `make -E copy_directory` is called? You may check that by inspecting the source directory manually. – Tsyvarev Nov 07 '16 at 10:37
  • Looks like there's just some wrong directory in our other cmake. – JuanLunaAtbp Nov 07 '16 at 10:39
  • Just checked a while ago. The "wrong directory" I was stating was wrong directory in one of my "add_library" paths in another cmake. – JuanLunaAtbp Nov 07 '16 at 10:40

1 Answers1

0

Just to clarify on this one.

This was resolved when I fixed one of the misspelled path used in another CMake.

Let's say the FetchMyExternal.cmake is the file with ExternalProject_add. And a CMakeLists.txt on another that has

add_library(EXTERNAL_LIBRARY 
    ${FINAL_LOCATION_DIR}/myClass.cpp
    ${FINAL_LOCATION_DIR}/External_Project/myClass.hpp
    ${FINAL_LOCATION_DIR}/External_Project/userOfClass.cpp
    ${FINAL_LOCATION_DIR}/External_Project/userOfClass.hpp
)

As you see above, the CMakeLists.txt that creates a library has
a wrong location on one of the files. The path of myClass.cpp should be

${FINAL_LOCATION_DIR}/External_Project/myClass.cpp

This is a separate CMakeLists.txt file but somehow it causes the the copy_directory of ExternalProject_add to leave out one of the files.

Correcting the location finally copied myClass.cpp to the final location.

Maybe it was "deleted" because the path was wrong? I'm not sure.