[CMake] CPack source package path

Eric Noulard eric.noulard at gmail.com
Mon Mar 9 09:58:37 EDT 2009


2009/3/9 Adolfo Rodríguez <dofo79 at gmail.com>:
> On Mon, Mar 9, 2009 at 11:47 AM, Eric Noulard <eric.noulard at gmail.com>
>>
>> I'm not sure but
>> if I remember well it should be  CPACK_TOPLEVEL_DIRECTORY.
>
> Hmm, I tried querying the names of all active variables and their values
> (after including CPack, of course) by doing
>
> get_cmake_property(res VARIABLES)
> foreach (i ${res})
>   message(STATUS ">> ${i} = ${${i}}")
> endforeach (i)

You may be trying to look for variables which are NOT defined by CMake
but by CPack.

CPACK_TOPLEVEL_DIRECTORY is defined when **cpack** is running and not
when **cmake** does.

> Grepping these results I found no variable named CPACK_TOPLEVEL_DIRECTORY,
> nor a variable whose value contained "_CPack_Packages/Linux-Source/TGZ/". I
> don't know if grepping the source code would help much, since CMake/CPack
> are apparently not exposing any variables with the required information.

I'm pretty sure they do, but like I said some are exposed during CMake run
and some others may be defined when CPack runs.

> Further clues would be greatly appreciated...

During CMake run you
0) define some CPACK_xxx variables to be handled byt
    INCLUDE(CPack)

1) In the end this creates 2 cmake-scripts languages files:
    CPackConfig.cmake  CPackSourceConfig.cmake

2) When running CPack (or make package or  make package_source)
    the 2 precedings files are loaded by CPack which creates
    some other CPACK_xxxx variables and then invokes the
    appropriate CPack generator (TGZ, RPM etc...)

3) The generator use some of the previously defined variables in order
    to do its job.


You have 2 majors steps:

   A) CMake run step
   B) CPack run step

both steps ARE separated
but they both run a CMake script interpreters with some CMake variables defined,
either from files (CMakeLists.txt, CPackConfigXXX.cmake) or builtin
(from source code).


-- 
Erk


More information about the CMake mailing list