Skip to content

CMake Build from NFS Mount on Windows (Cygwin)

Context

When your multiplatform code (Qt i.e.) needs to be build from Linux and Windows and your code resides on a Linux file server.

On the Windows machine Cygwin is installed and git from it is used by CMake to download thirdparty libraries.

There are 2 options available for Windows to access this resources: * Samba * NFS

For some reason a 'Samba' gets its uid and gid wrong which git has some problems with the download thirdparty libraries. NFS has no such problem.

Install NFS

NFS needs to be manually installed on a Windows system.

# For Server
Install-WindowsFeature NFS-Client
# For Workstation
Enable-WindowsOptionalFeature -FeatureName ServicesForNFS-ClientOnly, ClientForNFS-Infrastructure -Online -NoRestart

Mounting NFS

An NFS mount can only be performed on a drive not a directory. So in order to mount a directory a symbolic link is needed using mklink command. The mklink command needs to be enabled for regular users.

Find the nfs exports using the showmount

showmount -e server-name-or-ip

Mount the NFS to the S: drive.

mount -o anon server-name-or-ip:/path/to/directory S:

Create a symbolic link in the Cygwin users home directory.

mklink /D %HOMEDRIVE%%HOMEPATH%\cygwin\source S:\
Note

Deleting a symlink in Windows is done using rmdir and not del which is confusing because in Linux a >symbolic link is considered a file and not a directory.