[CMake] Parsing library list with keywords 'debug', 'optimized' and 'general' present

Yuri Timenkov yuri at timenkov.ru
Thu Mar 3 00:22:15 EST 2011


Hi Lori,

If you have options it's better to use imported libraries. They are far more
flexible and allow specifying more than just debug and optimized
configurations.

If you stuck with these keywords, you can look at QT4_EXTRACT_OPTIONS macro
in Qt4Macros.cmake (in CMake distribution). It contains only one option, but
you can use similar approach to extend for any number of named parameters.

On Thu, Mar 3, 2011 at 1:38 AM, Lori Pritchett-Sheats <lpritch at lanl.gov>wrote:

> After reading the documentation, target_link_libraries allows a user to
> pass a list with keywords debug, optimized and general to indicate which set
> of libraries to use when CMAKE_BUILD_TYPE is set. Is there a command,
> function or macro that parses lists that have these keywords and returns the
> appropriate set of libraries. Something like
> set(lib_list "debug;a;b;c;optimized;e;f;general;g;h")
> parse_library_list( lib_list DEBUG debug_libs OPT opt_libs GENERAL
> gen_libs)
> and it would return
> debug_libs=a;b;c
> opt_libs=e;f
> gen_libs=g;h
>
> I've tried using CMakeParseArguments to parse lib_list but haven't had any
> success. Though I would ask before attempting to write my own parser.
>
> --
> Lori A. Pritchett-Sheats, PhD.
> CCS-2, Computational Physics and Methods
> Office: 505-665-6675
> Fax: 505-665-4972
>
> Los Alamos National Laboratory
> P.O. Box 1663
> MS D413
> Los Alamos, NM 87544
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110303/5be1cd40/attachment-0001.htm>


More information about the CMake mailing list