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

Lori Pritchett-Sheats lpritch at lanl.gov
Wed Mar 2 17:38:22 EST 2011


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



More information about the CMake mailing list