ANSI C Based OPC UA Client/Server/PubSub SDK
Compiling the SDK and the Examples with NMake

This pages describes how to create NMake makefiles for the SDK and the examples using CMake.

Generate SDK Makefiles

Start a Visual Studio command prompt as administrator and change to the “bin” folder inside the CMake installation directory. Then start the CMake GUI from within the command prompt:


Click on “Browse Source…” and select the “src” directory below the SDK installation directory (see screenshot).


Select the build folder, i.e. the folder to save generated projects to. Click on “Browse Build…” and pick a folder of your choice. For this example, we’re using a directory named “nmake”.


Then click on “Configure”. A dialog window will open. Select “NMake Makefiles” from the drop-down list.


If all the settings are to your liking, press “Generate”. If you’ve changed anything, it’s necessary to click on “Configure” again before generating. When finished, the generated files can be found in the build folder specified above.


Build the SDK with NMake

Now we are ready to build the SDK. Still in the Visual Studio command prompt, change to the folder containing the generated files. Enter


followed by

nmake install

After a successful build, the result can be found in the folder specified at “CMAKE_INSTALL_PREFIX” above, in our case “C:/Program Files/uasdkc_src”, which is the default for the ANSI C SDK.


Generate Makefiles for the Examples

Generating makefiles for the examples delivered with the SDK is quite similar to generating SDK makefiles. We have to pick the source directory and the build directory first.

As source directory, choose the folder “examples” below the SDK installation directory. As build directory, pick a folder of your choice. We’ve created a subdirectory “nmake_examples” of the SDK installation directory.


Then click on “Configure” and pick your compiler from the drop-down list (see above).

Before generating the projects, we have to change “CMAKE_INSTALL_PREFIX”. Pick the same directory as set for the SDK, in this case “C:/Program Files/uasdkc_src” (see above).


Click on “Configure” again, then on “Generate”. When finished, the project files can be found in the build folder.


Now open you can build the examples in the same way as described above for the SDK. Change to the build folder (in our case the directory “nmake_examples” below the SDK installation folder) and enter

nmake install

When finished, the binaries can be found in the subfolder “bin” of the folder specified at “CMAKE_INSTALL_PREFIX”.