From b69aa4819d6f1eb9c1cec3283c8fbc54a207fc67 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 9 Dec 2021 17:55:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D1=81?= =?UTF-8?q?=20ExternalProject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MyxCMake/modules/MyxCMakeCommon.cmake | 3 +- .../modules/MyxCMakeExternalProject.cmake | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 MyxCMake/modules/MyxCMakeExternalProject.cmake diff --git a/MyxCMake/modules/MyxCMakeCommon.cmake b/MyxCMake/modules/MyxCMakeCommon.cmake index 4300020..eeae7a2 100644 --- a/MyxCMake/modules/MyxCMakeCommon.cmake +++ b/MyxCMake/modules/MyxCMakeCommon.cmake @@ -34,12 +34,11 @@ include(MyxCMakePkgConfig) include(MyxCMakeNinjaGeneratorHelper) # include(CMLibDocDoxygen) include(CMLibDocBreathe) -# include(CMLibExternalProject) +include(MyxCMakeExternalProject) include(MyxCMakeCPack) include(MyxCMakeUninstall) - # Additional functions include(MyxCMakeGenerateGitInfoHeader) include(MyxCMakeGeneratePrivateConfigHeader) diff --git a/MyxCMake/modules/MyxCMakeExternalProject.cmake b/MyxCMake/modules/MyxCMakeExternalProject.cmake new file mode 100644 index 0000000..aa6dc07 --- /dev/null +++ b/MyxCMake/modules/MyxCMakeExternalProject.cmake @@ -0,0 +1,49 @@ +include(ExternalProject) + +if(CMAKE_BUILD_TYPE) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) +endif() + +if(MYX_CMAKE_DIR) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DMYX_CMAKE_MAIN_DIR=${MYX_CMAKE_DIR}) +endif() + +if(CMAKE_C_COMPILER) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) +endif() + +if(CMAKE_C_FLAGS) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -E env "CFLAGS=${CMAKE_C_FLAGS}") +endif() + +if(CMAKE_CPP_COMPILER) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_CPP_COMPILER=${CMAKE_CPP_COMPILER}) +endif() + +if(CMAKE_CXX_FLAGS) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -E env "CXXFLAGS=${CMAKE_CXX_FLAGS}") +endif() + +if(CMAKE_Fortran_COMPILER) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}) +endif() + +if(CMAKE_Fortran_FLAGS) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -E env "FFLAGS=${CMAKE_Fortran_FLAGS}") +endif() + +if(CMAKE_INSTALL_PREFIX) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}) +endif() + +if(CMAKE_PREFIX_PATH) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}) +endif() + +if(Qt5_DIR) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DQt5_DIR=${Qt5_DIR}) +endif() + +if(Qt5Core_DIR) + list(APPEND MYX_CMAKE_EXTERNAL_PROJECT_ARGS -DQt5Core_DIR=${Qt5Core_DIR}) +endif()