Need mechanism to pass defines to library cpp files

Libraries are not slaves to the user of the library.
The library code is compiled separately and the behavior you are seeing is
the expected behavior. This is how libraries work.
i.e. a library is a separate compilable module that must be capable of being compiled
separately, in advance, and without any knowledge of any code that uses the library.
In most build environments, libraries are compiled up front, saved away, and then used (linked against)
as needed. Since multiple users of the library might want to set library compile defines separately/differently
there would be no way to build the library object without seeing the user code that used it.
The Arduino build methodology is not all that smart and does not save things like the compiled libraries
for re-use across different sketches. However, in the Arduno environment, even though the libraries
are not being saved for other sketches to use, the libraries are still actual libraries and
since a library is a separate entity from the code that uses it, there is no way to do what you are wanting.

There are some ways to kind of do what you are wanting to do.

You could play some games with the pre-processor to rename the names of the
functions that the user code ends up calling.

That way you could have two sets of functions in the actual library,
one that uses floating point and the other that does not.
To select which the user simply puts a #define above the inclusion of the library header.
(The default might be floating point, then if the magic define is set it drops to integer only)

Then in the library header file, the header remaps all the function names
based on some ifdef condition

At link time the appropriate function would be pulled in and you end up with
the version of the support you want/need.

Another similar alternative would be to still have the two sets of functions
but then have an inline wrapper function that simple calls the integer or floating
point version. The inline wrapper function would be in a header file that the users
sketch code includes. That way, conditionals could change it appropriately.
The library would still have to have both sets functions but only the ones
actually referenced would be linked in.

I do some similar things in my openGLCD library to map some older functions
to the newer functions. In my case, I even manipulate the parameters being
passed to the functions.
The user sketch code doesn't change, all the magic is done by the mapping macros.


Another alternative that would work but some might call "ugly" would be to put all
the code in the header file.
The code is no longer a library at that point but you could then do whatever you
wanted and any conditionals you put in the user code prior to including the header
file would work as you are wanting.

--- bill