From 8bc1fee6bbf5be6bacac5a47c9922eb7abfd7b4d Mon Sep 17 00:00:00 2001 From: Ni Kaixiang Date: Tue, 18 Apr 2023 17:10:10 +0200 Subject: [PATCH] clear-install-dir is performed before add-subdir --- CMakeLists.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd69cac52..05fb30a8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,6 +212,16 @@ include(Testing) # Start compile include(MacroRootDict) + +# Clear the install dir +if (NOT DEFINED INSTALL_CLEARDIR) + set(INSTALL_CLEARDIR ON) +endif () +if (${INSTALL_CLEARDIR} MATCHES "ON") + install(CODE "execute_process(COMMAND rm -r ${CMAKE_INSTALL_PREFIX})") +endif () + +# Compile and install for each subdir add_subdirectory(source) message("") @@ -236,14 +246,6 @@ message("") file(GLOB_RECURSE Headers "${CMAKE_CURRENT_SOURCE_DIR}/source/framework/*.h") -# Clear the install dir -if (NOT DEFINED INSTALL_CLEARDIR) - set(INSTALL_CLEARDIR ON) -endif () -if (${INSTALL_CLEARDIR} MATCHES "ON") - install(CODE "execute_process(COMMAND rm -r ${CMAKE_INSTALL_PREFIX})") -endif () - # Install the files of the main framework install(FILES ${Headers} DESTINATION include) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENCE DESTINATION .)