I'm in the process of adding Cmake-build capability to a Fortran project that 
currently follows a traditional recursive-make build structure.  I've converted 
all the makefiles to CMakeLists.txt files and can now produce all the target 
libraries and executables with their dependencies correctly recognized.  These 
dependencies have made a huge difference in allowing us to perform parallel 
builds and have the project ready to go *much* faster than before.  I have a 
top-level CMakeLists.txt file that contains a few library searches (e.g. 
LAPACK, BLAS) and then an add_subdirectory call for each subdirectory in the 
project.  Each subdirectory corresponds to a library and/or an executable.

Now that the listing files contain all the sources files they need, my current 
task is to go through and set the proper compiler/preprocessor flags to match 
the original makefiles.  We have several directories in our source tree that 
are auxiliary libraries that we store in our Subversion repository and build as 
part of our regular build process.  The libraries that are built in these 
directories are compiled with different compiler flags and different 
preprocessor definitions than the rest of the project.  I've been able to 
handle the preprocessor definitions by using add_definitions in the 
CMakeLists.txt files in the lower-level directories.  I see based on reading 
through some past threads (including the recent "Different CMAKE_CXX_FLAGS for 
different executables") on this list and on some StackOverflow questions that 
the COMPILE_FLAGS target property is very close to what I need (and actually 
*was* what I needed in several cases) but only appends flags to those currently 
 in use.  What I need is to be able to define a new set of compile flags (i.e. 
"forget everything you were using before and use THIS set in this directory").

I've started going through the documentation for Building External Projects[*] 
but the first line states that "[a]n "external project" is one that you can get 
the source code for, but does not readily build with a simple ADD_SUBDIRECTORY 
call in your CMakeLists.txt file."  This feels like it's designed to solve a 
slightly different problem than what I'm trying to do - I have an 
add_subdirectory call in my CMakeLists.txt file - is the proper fix for this 
issue to make the pieces that require different flags external projects?  Will 
making some of these libraries external projects mess with the dependency 
calculation?

I'm just getting started and trying to wrap my head around the options 
available.  What is the standard way of dealing with this issue?  Is there 
anything I'm missing?  Thank you for your assistance!

Tim
[w] 

[*] 
http://www.kitware.com/products/html/BuildingExternalProjectsWithCMake2.8.html
_______________________________________________
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

Reply via email to