[CMake] Linux In-the-source Build multiple modes without swithing

Dmytro Ovdiienko dmitriy.ovdienko at gmail.com
Fri Jun 19 15:56:21 EDT 2009


Charlie,

Move all your input data files to the resource folder and add following to
the end of CMakeLists.txt

######################################
# Post-build steps
######################################

add_custom_command(
    TARGET ${PROJECT_NAME}

    POST_BUILD
    COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory
${${PROJECT_NAME}_SOURCE_DIR}/resources ${${PROJECT_NAME}_BINARY_DIR}
)

PROJECT_NAME is a variable that holds name of the target.

After all your executale files will work correctly from VS and on Linux.

BTW, how about to add to CMake posibility to create symbolic/hard links?

2009/6/19 Charlie Sun <charliejjs at gmail.com>

> Because I would need to run the test using ctest, and the test cases have
> hard-coded and relative paths configured. If i do an out-of-source build.
> Some test cases would fail.
> I am also building the project on windows Visual studio, which does not
> have the problem with in-the-source. it will put object files in different
> folders (release/debug).
> Therefore, I don't know why it won't work in that way on Linux.
>
> Thanks and regards,
>
> Charlie
>
> On Wed, Jun 17, 2009 at 11:39 AM, Bill Hoffman <bill.hoffman at kitware.com>wrote:
>
>> Charlie Sun wrote:
>>
>>> Hi,
>>> I'm trying to do a linux  build with both release and debug mode. In
>>> stead of builing out of source as indicated on the FAQ 4.15, I really need
>>> to do in the source build. currently, if I do a release build and then a
>>> debug build and then another release build. It will actually rebuild the
>>> release and forgets the previous release build. Is it because cmake is only
>>> generating one set of objective files when doing in-the-source, either
>>> release or debug? Is there a way to have both? Any help is greatly
>>> appreciated!
>>>
>>> Regards,
>>>
>>
>> The only way to do what you want is to use out of source builds.  Why do
>> you have to do in-source builds?
>>
>> -Bill
>>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090619/024f3de0/attachment.htm>


More information about the CMake mailing list