After running cmake/make for my own project, I noticed cmake puts object files into a directory named CMakeFiles/myproject.dir/. How can I set a different build directory (e.g. bin/)? I know of the variables CMAKE_BINARY_DIR or CMAKE_CURRENT_BINARY_DIR, but they are supposed to be read-only.
- stackoverflow.com/questions/6594796/…user2288008– user22880082013-10-26 12:22:34 +00:00Commented Oct 26, 2013 at 12:22
Add a comment |
1 Answer
As you already note, you can't set CMAKE_BINARY_DIR variable.
Depending on your purposes you can use:
add_executable(simple_bin ${SOURCES}) install(TARGETS simple_bin DESTINATION ${PROJECT_SOURCE_DIR}/bin) add_executable(simple_bin ${SOURCES}) enable_testing() add_test(test_name simple_bin --data-directory ${PROJECT_SOURCE_DIR}/bin) 2 Comments
jbgs
This will put the executable file into
bindirectory. But what about the object files? They still are put into CMakeFiles/myproject.dirjbgs
Well, I was interested in having my own directory layout... and out of curiosity. But it seems it is not very convenient and not so easy to achieve. Thanks!