HEKTO
HEKTO

Reputation: 4191

CMake - how to call installation commands from the top level AFTER these commands from subdirectories?

My project contains a top-level CMakeLists.txt, which has this structure:

add_subdirectory(piece1)
add_subdirectory(piece2)
# --- etc.

install(CODE "execute_process(...)")

When I do make install all the installation commands from this file are called first - and it's not good for me, cause I need to setup symlinks and to do other steps, which require presence of files in destination directories.

So, I want to tell CMake to call install commands from this file after all the install commands from all my subdirectories.

How to do that?

Upvotes: 1

Views: 293

Answers (1)

Tsyvarev
Tsyvarev

Reputation: 66089

Just move install(CODE) into subdirectory (but add this subdirectory at the end ot the script, after others add_subdirectory calls).

I know no other ways to force CMake to execute your installation code after all others.

See also my answer to the related question.

Upvotes: 1

Related Questions