[CMake] Volunteering to maintain two new Find Modules
Hendrik Sattler
post at hendrik-sattler.de
Thu Jan 8 01:59:11 EST 2009
Am Wednesday 07 January 2009 23:54:05 schrieb Albert Astals Cid:
> Hi, i'm new to the list, so i'm not sure if this is the correct procedure,
> i read a bit in the wiki and it seems it is, so here i am.
>
> I want to add upstream the two attached modules so we don't have to
> maintain them in poppler. I'll have to maintain them upstream but maybe
> more people will use them and find bugs/improve.
>
> They are pretty simple and work for us in poppler.
Please don't do:
find_library(LIBOPENJPEG_LIBRARIES openjpeg)
as it makes it hard to use LIBOPENJPEG_LIBRARIES directly in
target_link_libraries().
Instead, use a variable for the cache, say 'openjpeg_LIBRARY' and do
find_library(openjpeg_LIBRARY openjpeg)
if (openjpeg_LIBRARY)
set (LIBOPENJPEG_LIBRARIES $(openjpeg_LIBRARY))
endif (openjpeg_LIBRARY)
You also don't need the first-level if-else-endif as find_path and
find_library will do nothing if the variable is already defined, just don't
reset the variables.
This makes the modules lik 5 lines which may as well be included directly in a
project. There is nothing complicated to do. It would be a nightmare to have
an official module for every library out there.
HS
More information about the CMake
mailing list