@@ -62,29 +62,12 @@ function generateModuleDocs(
6262 $ markdown .= "* Source code: [ $ relativeFilename]( $ url) \n\n" ;
6363 $ markdown .= $ content . "\n" ;
6464
65- if ($ namespace ) {
66- $ footer = <<<EOT
67- ## Basic usage
68-
69- ```cmake
70- # CMakeLists.txt
71- include( {$ namespace }{$ moduleName })
72- ```
73- EOT ;
74- } elseif (1 === preg_match ('/^Find(.+)$/ ' , $ moduleName , $ matches )) {
65+ if (1 === preg_match ('/^Find(.+)$/ ' , $ moduleName , $ matches )) {
7566 $ findPackageName = $ matches [1 ] ?? null ;
7667 $ findPackageUpper = strtoupper ($ findPackageName );
7768
78- $ footer = <<<EOT
79- ## Basic usage
69+ $ markdown .= <<<EOT
8070
81- ```cmake
82- # CMakeLists.txt
83- find_package( $ findPackageName)
84- ```
85- EOT ;
86-
87- $ footer_2 = <<<EOT
8871 ## Customizing search locations
8972
9073 To customize where to look for the $ findPackageName package base
@@ -102,26 +85,10 @@ function generateModuleDocs(
10285 -D {$ findPackageUpper }_ROOT=/opt/ $ findPackageName \
10386 -DSOMEOTHERPACKAGE_ROOT=/opt/some-other-package
10487 ```
105- EOT ;
106- } else {
107- $ footer = <<<EOT
108- ## Basic usage
10988
110- ```cmake
111- # CMakeLists.txt
112- include(cmake/ $ moduleName.cmake)
113- ```
11489 EOT ;
11590 }
11691
117- if (1 !== preg_match ('/## Basic usage[\r\n]/ ' , $ content , $ matches )) {
118- $ markdown .= "\n" . $ footer . "\n" ;
119- }
120-
121- if (isset ($ footer_2 )) {
122- $ markdown .= "\n" . $ footer_2 . "\n" ;
123- }
124-
12592 if (!file_exists ($ destination )) {
12693 mkdir ($ destination , 0777 , true );
12794 }
0 commit comments