I've overcome this by using the COMPILE_FLAGS source file property http://www.cmake.org/cmake/help/v2.8.11/cmake.html#prop_sf:COMPILE_FLAGS
Those flags will be appended to the rest of the compiler flags, so you can make them override the debug flags. For instance, if your debug flags are "-UNDEBUG -DDEBUG -O1", you can set the COMPILE_FLAGS to "-DNDEBUG -UDEBUG -O3" and (in my experience with GCC and Clang) the compiler will prefer the latter flags. Cheers, Jack On Tue, May 6, 2014 at 8:13 AM, [email protected] <[email protected]> wrote: > Dear All, > > We currently have a FORTRAN library we’re building with CMake (around > 1000 files of FORTRAN). > > ADD_LIBRARY( > > My_Fortran_Lib > > ……. > > ) > > For the release build we set the release compilation flags with > “CMAKE_Fortran_FLAGS_RELEASE” and set “CMAKE_BUILD_TYPE” to “Release” for > those flags to be honored. > > For the debug build we set the debug compilation flags with > “CMAKE_Fortran_FLAGS_DEBUG” and set “CMAKE_BUILD_TYPE” to “Debug” for those > flags to be honored. > > Out of those 1000 files we have a subset that we want to build always in > “Release” mode while the rest of the files can be built either in Debug or > Release depending on what “CMAKE_BUILD_TYPE” is set to. > > Is there a way to tell CMake to build a specific subset of files always > with Release flags even if “CMAKE_BUILD_TYPE” was Debug? > > Thank you for your help. > > *Mohamad O. Sindi* > > EXPEC Advanced Research Center > > Saudi Aramco > > > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake >
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
