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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -