I have a very simple directory structure:
Project
Project/src
Project/build
Source files are in Project/src
, and I do the out-of-src build in Project/build
. After running cmake ../ ; make
, I can run the executable thusly: Project/build$ src/Executable
- that is, the Executable
is created in the build/src
directory.
How do I set the location of the executable in the CMakeLists.txt
file? I've attempted to follow some of the examples found at cmake.org
, but the links that work don't seem to show this behaviour.
My Project/src/CMakeLists.txt
file is listed here.
include_directories(${SBSProject_SOURCE_DIR}/src)
link_directories(${SBSProject_BINARY_DIR}/src)
set ( SBSProject_SOURCES
main.cpp
)
add_executable( TIOBlobs ${SBSProject_SOURCES})
And the top-level Project/CMakeLists.txt
:
cmake_minimum_required (VERSION 2.6)
project (SBSProject)
set (CMAKE_CXX_FLAGS "-g3 -Wall -O0")
add_subdirectory(src)