[Cmake] problems custom target dependencies
Jeongnim Kim
jnkim at ncsa . uiuc . edu
Thu, 06 Nov 2003 12:34:38 -0600
Hello,
I'm very new to cmake but find it very useful and powerful for our C++
projects.
I'm trying to create a fortran library and follow the instruction posted on
12 March 2003 with a title "Using CMake for scientific computing?".
http://www . cmake . org/pipemail/cmake/2003-March/003469 . html
There was a post on similar problems to my problem: custom target dependencies
but I could not find any follow-up for that thread.
Attached is my CMakeList.txt and would appreciate your suggestions how to
fix the problem. The version of cmake I'm using is 1.8.1.
-------CMakeList.txt
PROJECT(Abinit)
ADD_CUSTOM_TARGET(libabinit.a ALL)
# list of fotran codes
SET(FSOURCES
recip cpointg speck bzdef bzred inbz
listmg symgen pointg pgsymo trgsym fccsym bccsym bctsym
group1 pgl1 rlv3 atftm1 rot1 symatm sort3
spchek trmlen)
FOREACH(source ${FSOURCES})
ADD_CUSTOM_COMMAND(TARGET libabinit.a
SOURCE ${Abinit_SOURCE_DIR}/${source}.f
COMMAND g77
ARGS -o ${Abinit_BINARY_DIR}/${source}.o
${Abinit_SOURCE_DIR}/${source}.f
OUTPUTS ${Abinit_BINARY_DIR}/${source}.o)
SET(OUTPUTS ${OUTPUTS} ${Abinit_BINARY_DIR}/${source}.o)
SET(OUTPUTS_STRING "${OUTPUTS_STRING} ${Abinit_BINARY_DIR}/${source}.o")
ENDFOREACH(source)
ADD_CUSTOM_COMMAND(TARGET libabinit.a
COMMAND ar
ARGS cr ${Abinit_BINARY_DIR}/libabinit.a
${OUTPUTS_STRING}
OUTPUTS ${Abinit_BINARY_DIR}/libabinit.a
DEPENDS ${OUTPUTS}
)
--------- Makefile
To summarize my problem (tried several method, including ADD_DEPENDENCIES,
but in vain), I see that Makefile has an empty field:
libabinit_a_DEPEND_LIBS =
Thanks in advance.
Best wishes,
Jeongnim Kim
---------------------------------------------------------------
Jeongnim Kim e-mail: jnkim at uiuc . edu
NCSA Tel: 217-244-6319 (NCSA)
Beckman Institute 217-333-3324 (MCC)
405 N Mathews Av. Fax: 217-244-2909
Urbana, IL 61801
---------------------------------------------------------------