[Cmake] Using CMake for scientific computing ?
Andy Cedilnik
andy.cedilnik at kitware.com
Wed Mar 12 16:51:36 EST 2003
Hi Christophe,
Some CMake 1.6 magic here, so make sure to update.
PROJECT(FortranProject)
ADD_CUSTOM_TARGET(Project ALL)
FOREACH(source ${SOURCES})
ADD_CUSTOM_COMMAND(TARGET Project
SOURCE ${FortranProject_SOURCE_DIR}/${source}.f
COMMAND g77
ARGS -o ${FortranProject_BINARY_DIR}/${source}.o
${FortranProject_SOURCE_DIR}/${source}.f
OUTPUTS ${FortranProject_BINARY_DIR}/${source}.o)
SET(OUTPUTS ${OUTPUTS} ${FortranProject_BINARY_DIR}/${source}.o)
SET(OUTPUTS_STRING
"${OUTPUTS_STRING} ${FortranProject_BINARY_DIR}/${source}.o")
ENDFOREACH(source)
ADD_CUSTOM_COMMAND(TARGET Project
COMMAND ar
ARGS cr ${FortranProject_BINARY_DIR}/libProject.a
${OUTPUTS_STRING}
OUTPUTS ${FortranProject_BINARY_DIR}/libProject.a
DEPENDS ${OUTPUTS})
ADD_CUSTOM_COMMAND(TARGET Project
SOURCE Project
DEPENDS ${FortranProject_BINARY_DIR}/libProject.a)
On Wed, 2003-03-12 at 16:22, Christophe Dupre wrote:
> I looked at your FAQ entry. I think I understand how it works, but I'm not
> sure it would apply for Fortran code. According to the documentation, the
> ADD_CUSTOM_TARGET command creates a new target that's always run. So if I
> were to use that, my Fortran code would be recompiled each and every time.
> I though the point of using Makefile was the automagic dependency
> computation.
> Even then, how would I avoid having one ADD_CUSTOM_COMMAND per fortran
> source code ?
>
>
> Just to make sure we understand each other, I'm not talking about a single
> fortran file, but complete projects made in Fortran, without a single line
> of C/c++ code.
>
> Also, is there a way to NOT have to specify each file in the CMakeLists ?
> I'd like to say 'compile everything in ./src and make a library out of
> it'. I tried to use AUX_SOURCE_DIRECTORY, but the documentatiojn isn't
> clear on its purpose.
More information about the CMake
mailing list