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 www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

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

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake