diff options
author | Chad Elliott <elliottc@objectcomputing.com> | 2022-10-20 09:46:16 -0500 |
---|---|---|
committer | Chad Elliott <elliottc@objectcomputing.com> | 2022-10-20 09:46:16 -0500 |
commit | 2d743f8f88dfa882922d9a16aa59486a2d1fc098 (patch) | |
tree | af39d301f40e1b1dd0cde3234adae19545b57857 /modules/CMakeWorkspaceCreator.pm | |
parent | 9b2f5741c811fdd78f566e6293724f1f1babb2b2 (diff) | |
download | MPC-2d743f8f88dfa882922d9a16aa59486a2d1fc098.tar.gz |
Insert subdirectories after all find_package() calls to allow for configuration.
Diffstat (limited to 'modules/CMakeWorkspaceCreator.pm')
-rw-r--r-- | modules/CMakeWorkspaceCreator.pm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/CMakeWorkspaceCreator.pm b/modules/CMakeWorkspaceCreator.pm index a71e9ce8..9c3c93d9 100644 --- a/modules/CMakeWorkspaceCreator.pm +++ b/modules/CMakeWorkspaceCreator.pm @@ -20,6 +20,12 @@ use vars qw(@ISA); @ISA = qw(WorkspaceCreator); # ************************************************************ +# Data Section +# ************************************************************ + +my $version = '3.12.0'; + +# ************************************************************ # Subroutine Section # ************************************************************ @@ -80,14 +86,16 @@ sub write_and_compare_file { ## the file and then insert add_subdirectory() calls to it. my @lines; my $insert; - my $version = '3.12.0'; my $fh = new FileHandle(); if (open($fh, $wsname)) { for(my $i = 0; <$fh>; $i++) { push(@lines, $_); - if (/cmake_minimum_required\(VERSION ([^\)]+)\)/) { + if (/find_package\(/) { + ## We need to insert the calls to add_subdirectory() after the last + ## find_package() to allow for configuration settings from packages. + ## This will allow us to modify the CMakeLists.txt to possibly make + ## certain subdirectories conditional. $insert = $i; - $version = $1; } } close($fh); |