File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ ecosystem.
4444
4545CMake is quite lenient regarding code style, but applying consistency for
4646writing CMake files can enhance both code quality and comprehension of the build
47- system, especially when multiple developers are involved. Following some naming
47+ system, especially when multiple developers are involved. Following some coding
4848conventions can maintain a clear and organized CMake project structure while
4949avoiding conflicts with external libraries and CMake scope.
5050
@@ -195,8 +195,18 @@ these variables become distinct.
195195
196196### 2.3. Check modules
197197
198- Use ` check_compiler_flag() ` , ` check_source_compiles() ` , ` check_source_runs() `
199- instead of language-specific ` check_<LANG>_...() ` .
198+ * Use ` check_compiler_flag() ` , ` check_source_compiles() ` , ` check_source_runs() `
199+ instead of language-specific ` check_<LANG>_...() ` .
200+
201+ * For checking header files, use ` CheckIncludeFiles ` module instead of
202+ ` CheckIncludeFile ` or ` CheckIncludeFileCXX ` . It simplifies and unifies
203+ checking single or multiple headers into a common usage across the code.
204+
205+ ``` cmake
206+ include(CheckIncludeFiles)
207+ check_include_files(sys/types.h HAVE_SYS_TYPES_H)
208+ check_include_files("sys/socket.h;net/if.h" HAVE_NET_IF_H)
209+ ```
200210
201211## 3. Variables
202212
You can’t perform that action at this time.
0 commit comments