[CMake] How about GNU Automatic Variables
Zhang Xianyi
traits.zhang at gmail.com
Fri Nov 28 04:29:42 EST 2014
Hi,
I want to use cmake for a library which supports different floating point
precision.
In Makefile, I used $(*F) to generate the different function name.
Could I use $(*F) in cmake?
==================
test.c
===============
#ifdef DOUBLE
#define TYPE double
#else
#define TYPE float
#endif
void CNAME(TYPE * a)
{
a[0]=1.0;
}
===========
Makefile
================
OBJS=test_single.o test_double.o
all:$(OBJS)
ar -rua libtest.a $(OBJS)
test_single.o : test.c
$(CC) -DCNAME=$(*F) -UDOUBLE -c $< -o $(@F)
test_double.o : test.c
$(CC) -DCNAME=$(*F) -DDOUBLE -c $< -o $(@F)
============
Thank you
Xianyi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141128/8fa264d2/attachment-0001.html>
More information about the CMake
mailing list