From 4cd9c6dd4c75402c5ce32b67105f2305015fb67e Mon Sep 17 00:00:00 2001 From: ski Date: Wed, 10 Dec 2014 15:10:29 +0300 Subject: [PATCH] 0025585: Procedure of CMakeLists generation must be improved to make VTK product fully optionally Compilation of VTK toolkits is handled by cmake toggle USE_VTK. --- src/WOKTclLib/OS.tcl | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/WOKTclLib/OS.tcl b/src/WOKTclLib/OS.tcl index 60363e7..126f0ba 100755 --- a/src/WOKTclLib/OS.tcl +++ b/src/WOKTclLib/OS.tcl @@ -3023,10 +3023,22 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { lappend aBuff "" lappend aBuff "if (BUILD_${aModule})" foreach aToolKit [${aModule}:toolkits] { - lappend aBuff " LIST(APPEND USED_TOOLKITS ${aToolKit} )" - lappend aBuff " foreach( TK \$\{${aToolKit}_DEPS\})" - lappend aBuff " LIST(APPEND USED_TOOLKITS \$\{TK\} )" - lappend aBuff " endforeach()" + set isVTK 0 + set anIndent "" + if {[regexp -nocase {.*vtk.*} $aToolKit]} { + set isVTK 1 + set anIndent " " + } + if {$isVTK} { + lappend aBuff " if (USE_VTK)" + } + lappend aBuff "${anIndent} LIST(APPEND USED_TOOLKITS ${aToolKit} )" + lappend aBuff "${anIndent} foreach( TK \$\{${aToolKit}_DEPS\})" + lappend aBuff "${anIndent} LIST(APPEND USED_TOOLKITS \$\{TK\} )" + lappend aBuff "${anIndent} endforeach()" + if {$isVTK} { + lappend aBuff " endif()" + } } foreach anExecutable [OS:executable ${aModule}] { lappend aBuff " LIST(APPEND USED_TOOLKITS ${anExecutable} )" @@ -3046,12 +3058,24 @@ proc OS:MKCMK { theOutDir {theModules {}} {theAllSolution ""} } { file mkdir "$theOutDir/$aSubPath/$aToolKit" } + set isVTK 0 + set anIndent "" + if {[regexp -nocase {.*vtk.*} $aToolKit]} { + set isVTK 1 + set anIndent " " + } + if {$isVTK} { + lappend aBuff "IF (USE_VTK)" + } #add directory to main cmake metafile - lappend aBuff "IF(EXISTS \"\$\{TK_ROOT_DIR\}/$aSubPath/${aToolKit}\")" - lappend aBuff " add_subdirectory(\$\{TK_ROOT_DIR\}/$aSubPath/${aToolKit})" - lappend aBuff "ELSE()" - lappend aBuff " LIST(APPEND UNSUBDIRS \"$aSubPath/${aToolKit}\")" - lappend aBuff "ENDIF()" + lappend aBuff "${anIndent}IF(EXISTS \"\$\{TK_ROOT_DIR\}/$aSubPath/${aToolKit}\")" + lappend aBuff "${anIndent} add_subdirectory(\$\{TK_ROOT_DIR\}/$aSubPath/${aToolKit})" + lappend aBuff "${anIndent}ELSE()" + lappend aBuff "${anIndent} LIST(APPEND UNSUBDIRS \"$aSubPath/${aToolKit}\")" + lappend aBuff "${anIndent}ENDIF()" + if {$isVTK} { + lappend aBuff "ENDIF()" + } # create cmake metafile into target subdir osutils:cmktk $theOutDir/$aSubPath $aToolKit false ${aModule} -- 2.39.5