It can be a pain to refrence ExternalProjects when their install targets are messed up. So one may want to build and install ExternalProjects once before generating main project files for given project. Is it possible with CMake and how to do it?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
You may use
cmake
call withinexecute_process
for configure and build CMake project, which contains ExternalProject:other_project/CMakeLists.txt:
CMakeLists.txt:
Such a way other_project will be configured and built (because of
--build
option) in directory${CMAKE_BINARY_DIR}/other_project
. If you do not disable installation inExternalProject_Add
call, then it will performed when building other_project.Normally, you want some options to ExternalProject, like
SOURCE_DIR
,BINARY_DIR
,INSTALL_DIR
, to be deduced from variables in the main project. You have two ways for achive that:Create CMakeLists.txt for other_project with
configure_file
, called from main project (beforeexecute_process
command).Pass variables from main project as
-D
parameters to${CMAKE_COMMAND}
.