[CMake] Outputting targets to subdirectories

Ryan Pavlik rpavlik at iastate.edu
Fri Jun 4 07:23:47 EDT 2010


Really, the best way to handle this is to set CMAKE_INSTALL_PREFIX to 
some local directory for testing, and then do an install creating the 
desired directory structure that way.

Ryan

On 6/4/10 5:38 AM, Lars Sønderby Jessen wrote:
> Hi,
>
> I have a project where I need to generate 2 target files in different folders:
>
> <OUTPUT_DIR>/myapp.exe
> <OUTPUT_DIR>/plugins/myplugin.dll
>
> I've created the following CMakeLists.txt:
> <SOURCE_DIR>/CMakeLists.txt
> <SOURCE_DIR>/plugins/CMakeLists.txt
>
> With the following contents:
>
> <SOURCE_DIR>/CMakeLists.txt:
> 	
> cmake_minimum_required(VERSION 2.8)
> project(myproject)
> add_executable(myexe main.cxx)
> add_subdirectory(plugins)
>
>
> <SOURCE_DIR>/plugins/CMakeLists.txt:
>
> cmake_minimum_required(VERSION 2.8)
> set(RUNTIME_OUTPUT_DIRECTORY plugins)
> add_library(myplugin SHARED myplugin.cxx)
>
> But this produces the following output:
> ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/myexe.exe
> ${CMAKE_CURRENT_BINARY_DIR}/plugins/${CMAKE_CFG_INTDIR}/myplugin.dll
>
> How can I change the 2nd CMakeLists.txt file such that I get the following output:
> ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/myexe.exe
> ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/plugins/myplugin.dll
>
> ?
>
>
> - Lars
> _______________________________________________
> 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
>    


-- 
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com/



More information about the CMake mailing list