[CMake] Changing directory layout with Cpack ?

Stephen Collyer scollyer at netspinner.co.uk
Fri Nov 30 05:52:10 EST 2007


Eric Noulard wrote:
> 2007/11/28, Stephen Collyer <scollyer at netspinner.co.uk>:
>> I have a build tree set up like this:
>>
>> src/<subdirs>
>> builds/linux
>> builds/win32
>> install/linux/bin
>> install/linux/lib
>> install/win32
>>
>> where all the source code lives under src, I do out-of-source
>> builds under builds, and I install built objects into install/linux
>> and install/win32.
> 
> How do you do that?
> 
> 1) make install in each build tree?
>     or do you use

Yes.

> 2) make DESTDIR=/path/to/install install ?

No.

> 3) or did you SET
>      LIBRARY_OUTPUT_PATH
>      EXECUTABLE_OUTPUT_PATH

No.

> CPack package all the thing you install using INSTALL
> concerning path prefix you may use
> CMAKE_INSTALL_PREFIX in order to influence
> INSTALL command using __RELATIVE__ PATH
> if you use absolute path "CMAKE_INSTALL_PREFIX" will not
> be used.
> 
> Could you send us some of your INSTALL command usage
> for linux and win32 case?

In the top level cmakelists.txt file I have:

SET(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})

and in a lower level directory, src/lib, I have:

IF (WIN32)
    INSTALL(TARGETS Comms Runnable
            ARCHIVE DESTINATION install/win32
            LIBRARY DESTINATION install/win32
            RUNTIME DESTINATION install/win32
           )
ELSE(WIN32)
    INSTALL(TARGETS Comms Runnable
            ARCHIVE DESTINATION install/linux/lib
            LIBRARY DESTINATION install/linux/lib
            RUNTIME DESTINATION install/linux/bin
           )
ENDIF(WIN32)

-- 
Regards

Steve Collyer
Netspinner Ltd


More information about the CMake mailing list