Here is a suggestion to better document cmake.port.mk. Rafael
Index: port-modules.5 =================================================================== RCS file: /cvs/src/share/man/man5/port-modules.5,v diff -u -p -r1.278 port-modules.5 --- port-modules.5 2 Dec 2025 13:05:28 -0000 1.278 +++ port-modules.5 1 Jan 2026 09:35:45 -0000 @@ -566,6 +566,20 @@ Changes to `test' as this is standard for CMake projects. Also this module has the following knobs: .Bl -tag -width Ds +.It USE_NINJA +If set to `Yes', use +.Xr ninja 1 +as the build system instead of +.Xr make 1 . +Adds +.Pa devel/ninja +to +.Ev BUILD_DEPENDS . +If set to `No', uses Unix Makefiles generator and adds +.Sq nojunk +to +.Ev DPB_PROPERTIES . +Default value is `Yes'. .It MODCMAKE_WANTCOLOR If set to `Yes', CMake will colorize its output. Should not be used in ports Makefiles. @@ -581,11 +595,52 @@ build. The exact effects on the build process depend on settings specified in the CMake config files. Default value is `No'. +.It MODCMAKE_LDFLAGS +If set, the value will be passed to CMake via the +.Ev LDFLAGS +environment variable during configuration. +CMake uses this only on the first configuration to set +.Ev CMAKE_EXE_LINKER_FLAGS_INIT , +.Ev CMAKE_SHARED_LINKER_FLAGS_INIT , +and +.Ev CMAKE_MODULE_LINKER_FLAGS_INIT . +Default value is empty. .El -Also, -.Sq nojunk -is added to DPB_PROPERTIES because CMake's include files parser cheats -too much. +.Pp +When used together with other modules, appropriate variables are +automatically passed to CMake: +.Bl -tag -width "lang/python" -compact +.It java +.Ev JAVA_HOME +is set in +.Ev CONFIGURE_ENV +and +.Ev MAKE_ENV . +.It lang/python +Python executable, library, and include paths are set for FindPython, +FindPython3, and FindPythonN modules. +.It lang/lua +Lua include directory and library path are set for FindLua. +.It lang/ruby +Ruby executable is set for FindRuby. +.It lang/tcl +Tcl version, include, library directories and library name are set in +.Ev CONFIGURE_ENV . +.It x11/tk +Tk version, include, library directories and library name are set in +.Ev CONFIGURE_ENV . +.El +.Pp +The environment variable +.Ev MODCMAKE_PORT_BUILD +is automatically set to `yes' in +.Ev CONFIGURE_ENV +and +.Ev MAKE_ENV . +This disables CMake's default optimization flags, putting them under +ports control, and prevents network operations +.Pq file DOWNLOAD/UPLOAD +during the build. .It devel/cabal See .Xr cabal-module 5
