Cmake install header without a specific method -


i have small library made stand along except 1 optional method in class requires imagemagick. looking make possible not compile method if machine not have imagemagick installed; rather failing. issue header still have method defined (though not compiled). there way remove method header using cmake or other approach?

wrap definition in preprocessor definition:

#ifdef have_imagemagick   void myfunctiondefinition(void); #endif 

then, in cmake, if imagemagick found, add definition project. cmake pass definition command line of compiler, define preprocessor token.

if(imagemagick_found)  # or whatever cmake variable holds info     add_definitions(-dhave_imagemagick) endif() 

alternatively, if have many such defines, consider include file hold of these configurations. cmake command configure_file can expand out entire file's worth of configuration statements @ once.


Comments