cmake and visual studio

I recently did my first steps with cmake and it wasn’t easy as there’re not much sources on how to use it with visual studio. After some try and error I got some things done which I wanted to document here.

Variables

Build Debug or Release dll’s

cmake offers different ways for building release and debug configs with visual studio depending on the generator.

nmake makefiles:

Visual Studio:

Add preprocessor definitions

Download a file and check the status

Downloads the file BINDING_FILE from http://ws0.org/xbmc/win32/ and puts it into the build directory.

Unpack zip file

execute_process executes the command during compile time and not on configure.

Create an archive with cpack

Adds a new target ‘package’ which could be called with ‘nmake package’ or ‘cmake –build . –target=PACKAGE.’
Inside the zip is the directory visualization.waveform with the contents
of the directory visualization.waveform plus the waveform.dll file.

Use external Visual Studio project file

Generates a target ‘milkdrop’ for use like add dependencies. Visual Studio generators only.
INCLUDE_DIRECTORIES has no affect on those targets.

Set Visual Studio compile parameters

Set compile language per source

Sets the compiler language to C for all sources in ${EVALLIBSRC}

Add additionale include and linker directories

Leave a Reply

Your email address will not be published. Required fields are marked *