My macro library for CMake

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

My macro library for CMake

Alibek Omarov
Hello, fellow CMake users!

For almost 3 years of using CMake in my opensource project, I everytime encounter the verbosity of CMake scripts. So now I have written a small library of shorthand utility macros. 

At this time it have some macros specific for my project, but I hope others can find it useful too.
List of macros:
1. fwgs_install -- installs library file. On MSVC installs in separate directories, corresponding to selected configuration in Visual Studio. For Debug it also installs PDB file automatically.
2. fwgs_conditional_subproject -- adds subdirectory if conditions was met. I did this because there is some subdirectories, which can be omitted in some configurations.
3. fwgs_set_default_properties -- default properties for target. For me it enables PIC and removes "lib" prefix on Windows.
4. fwgs_string_option -- option() but for strings.
5. fwgs_library_dependency -- downloads dependency from Web, unpacks it, calls find_library to configure and links to the target. Also does a cache check, if developer have deleted dependency folder for some reason. Just a big shortcut.
6. fwgs_add_compile_options -- like add_compile_options, but with language specification: C for C/C++ flags, CXX for C++ flags, CONLY for C only flags. Also should work with CMake 2.8, which is still used in Ubuntu 12.04, Debian 7 and Steam Runtime toolchain.

There is other too, but I plan to rework them.

I accept any criticism. I understand that many of them maybe aren't needed, I just doesn't found any equivalent in documentation.

Thanks for attention!
Alibek Omarov a.k.a a1batross


Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: