In your top most CMakeLists.txt file you might want to try adding the
following:
# ---------- Setup output Directories -------------------------
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Libraries"
)
# --------- Setup the Executable output Directory -------------
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all Executables."
)
# --------- Setup the Executable output Directory -------------
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all static libraries."
)
Those lines will put ALL libraries (both dynamic and static) and ALL
executables from EVERY subproject in a directory called "Bin" inside
the build folder.
You lines of ADD_SUBDIRECTORY( nth_subfolder common_binary_dir )
should be changed to be something like:
ADD_SUBDIRECTORY( nth_subfolder ${PROJECT_BINARY_DIR}/nth_subfolder)
Now, the header paths _could_ be solved with the following:
In the Top most CMakeLists.txt file use the following:
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/nth_subfolder)
and do that for each "common" folder.
OR if your project is extremely well defined directory structure wise
then you can add the following to each subproject:
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Common_Headers)
Hope that helps.
_________________________________________________________
Mike Jackson [email protected]
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
On Mar 7, 2009, at 10:31 AM, Wojciech Migda wrote:
Hi all,
I have a build system with several subtargets residing in respective
subfolders. What is important - I'm using common binary directory for
all targets. The command I use is:
ADD_SUBDIRECTORY( nth_subfolder common_binary_dir )
The common binary folder was chosen to have all static libraries
created
by respective subtargets stored in a single place. However, this leads
to a problem with dependencies derived from C/C++ source files to
headers which are located in local subdirectories and not in common
headers storages.
The build system has got few common include folders which are
defined in
the topmost CMakeLists.txt file, and for each subtarget its own
CMakeLists.txt adds local directory to the include list. This works
for
compilation, as all -I compiler switches are generated exactly as they
should. Unfortunately, when cmake determines target dependencies
(depend.make file) it looks for headers based on information stored in
the CMakeFiles/CMakeDirectoryInformation.cmake file stored in the
binary
directory, which in my case is common for all targets. This means that
with each target the contents of CMakeDirectoryInformation.cmake is
overwritten with the information derived from the last processed
target.
As a result during build time when dependencies are being checked
headers which are present only in local directories are not taken into
account and a large part of dependency information is being lost.
Thus,
I'd like to ask for advice: should I change the organization of my
build
system to get rid of the common binary directory, or should I file a
feature request for cmake to update and not overwrite contents of the
CMakeDirectoryInformation.cmake file.
With kind regards,
Wojtek Migda
----------------------------------------------------------------------
"Teraz gry" - program dla prawdziwych graczy! >>> http://link.interia.pl/f2080
_______________________________________________
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
_______________________________________________
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