[CMake] breaking overly long lines without creating a list?

Daniel Franke franke.daniel at gmail.com
Wed Nov 18 15:00:29 EST 2009


Hi all,

I'd like to break overly long lines in CMakeLists.txt into something more 
readable. But breaking a string into two as shown below generates a list, 
which -- in this case -- breaks the compilation.

-- 8< --
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
  set (CMAKE_Fortran_FLAGS     "-Wall -Wextra -Wno-unused-parameter "
                               "-fimplicit-none")
...
-- 8< --

Using '\' to continue the line doesn't work either. If 'cmake' takes it, 
eventually 'make' will complain. 

This works, but sort of misses the point of increasing readability:
-- 8< --
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
  set (CMAKE_Fortran_FLAGS     "-Wall -Wextra")
  set (CMAKE_Fortran_FLAGS     "${CMAKE_Fortran_FLAGS} -Wno-unused-parameter")
  set (CMAKE_Fortran_FLAGS     "${CMAKE_Fortran_FLAGS} -fimplicit-none")
...
-- 8< --

Any hints?

Thanks

	Daniel


More information about the CMake mailing list