[CMake] SuperProject package/install
Knox, Kent
Kent.Knox at amd.com
Thu Nov 12 11:53:32 EST 2015
[rm] Right now, the Main ExternalProject_add INSTALL_COMMAND is "". How can I change this (or add another step) to build the package target (I don't want to just hard-code make package, as it should work with MSVC too). I've tried things like '${CMAKE_COMMAND} cmake--build package' but haven't had any luck.
[kk] 'package' is a target of your generated build environment. You can specify to 'cmake --build' a target of your choosing. Look at the '--build' docs here:
https://cmake.org/cmake/help/v3.3/manual/cmake.1.html
BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target package
[rm] Once I get package running, how can I get the system to copy the resulting *.zip file out to the top level directory?
[kk] Add a custom step to your external project, which depends on the build/install step to finish to copy whatever you want
ExternalProject_Add_Step( myEPname copyPackage
COMMAND ${CMAKE_COMMAND} -E copy_directory ${myLibDir} ${packageDir}/${LIB_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/include ${packageDir}/include
DEPENDEES build
)
----------------------------------------------------------------------
Message: 1
Date: Wed, 11 Nov 2015 11:04:13 -0800
From: Rob McDonald <rob.a.mcdonald at gmail.com>
To: CMake ML <cmake at cmake.org>
Subject: [CMake] SuperProject package/install
Message-ID:
<CAEppYpGdedUFmFfryOTncCTmiMt_cf8o7+ujzo1ArByiDQYqsg at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
All,
I have a SuperProject set up with ExternalProject_add the way some
other projects do.
The SuperProject has two EP's -- Libraries and Main. Libraries has a
bunch of its own EP's. Main is my core project.
When some users use this setup, they're confused at the end --
everything has worked, but the project hasn't been installed, and the
results of compilation are buried several directories deep.
My Main project has a 'package' target set up by CPack. I'd like the
SuperProject to conclude by executing that build target, and then
copying the resulting file to the top-level build directory from the
SuperProject. To complicate things, the target file name is not
fixed, it uses the version number -- which is not known to the
SuperProject level.
Right now, the Main ExternalProject_add INSTALL_COMMAND is "". How
can I change this (or add another step) to build the package target (I
don't want to just hard-code make package, as it should work with MSVC
too). I've tried things like '${CMAKE_COMMAND} cmake--build package'
but haven't had any luck.
Once I get package running, how can I get the system to copy the
resulting *.zip file out to the top level directory? I'd like it to
end up in the CMake build directory at the top of the SuperProject,
but I haven't figured out how to make that happen yet.
Thanks,
Rob
More information about the CMake
mailing list