[CMake] Proper use of cached Boolean value

Mike Jackson imikejackson at gmail.com
Wed Mar 12 14:50:17 EDT 2008


I am working with ParaView using the Extra_external_modules cmake  
variable. The problem is that I have 2 extra modules that I would  
like to build. Both of those modules include code from another  
project (plus include_directories and some other stuff). The problem  
is if I put BOTH modules into the Extra_External_Modules variable,  
then when cmake finishes its run, I get warnings about the same files  
being added twice to the vtkPVFilters target.

I have tried a few different ways to "guard" the actual cmake code  
that does all the inclusion but I get other problems such as include  
paths not showing up (The include path to boost and the common code).

I have tried the following:

IF (NOT DEFINED PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED)

IF (NOT PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED)

neither have the desired effect.

Down in the cmake source I have tried the following:


IF (NOT DEFINED PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED)
  .... Do a bunch of stuff
INCLUDE_DIRECTORIES (${MXA_SOURCE_DIR}/src)
	SET (PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED TRUE)
ENDIF (NOT DEFINED PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED)

IF (NOT DEFINED PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED)
  .... Do a bunch of stuff
INCLUDE_DIRECTORIES (${MXA_SOURCE_DIR}/src)
	SET (PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED TRUE BOOL "Docs")
ENDIF (NOT DEFINED PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED)


IF (NOT DEFINED PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED)
  .... Do a bunch of stuff
INCLUDE_DIRECTORIES (${MXA_SOURCE_DIR}/src)
	SET (PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED TRUE INTERNAL "Docs")
ENDIF (NOT DEFINED PARAVIEW_MXADATAMODEL_SOURCES_INCLUDED)

None of these are really having the right effect, as to including  
some INCLUDE paths.

I'm sure I am just not fully understanding the cmake stack and how  
variables are set/over written/saved.

Could someone help me out with the proper way to guard for multiple  
inclusions?

If you want the whole cmake file I can send that through..

Thanks
--
Mike Jackson
imikejackson & gmail * com






More information about the CMake mailing list