views:

22

answers:

1

I am in the process of adding cmake support to a project and noticed that, after generating an out of source Visual Studio project, adding new files through Visual Studio puts them in the Build directory, and not in the Source directory. This is suboptimal.

Is there any way to change where VS adds new files, and can I set this in a CMakeLists.txt file?

A: 

You can choose the ouput directory for CMake like this:

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${MY_DIR})

For Visual Studio projects use this:

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${MY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${MY_DIR})
the_void
That is not quite what I want - I merely want to change the location field in the "Add New Item" Dialog to be ${CMAKE_CURRENT_SOURCE_DIR}.
Voltaire