Can't build 32bit DLL files with Cmake

Hi currently I am attempting to build 32bit DLL files using cmake to execute a program however when I execute I only get a new solution file not new 32bit DLL files

cmake command ran in command prompt: cmake -H"OptickCore.dll" -B"build\cmake" -G “Visual Studio 9 2008”

Below is my CMakeLists.txt file CMakeLists.txt :


cmake_minimum_required(VERSION 2.6) add_library(mylib SHARED DarkGDK_MovingBall.cpp) set_target_properties(mylib PROPERTIES COMPILE_FLAGS “-m32” LINK_FLAGS “-m32”)

Why am I getting only a new solution file instead of a new DLL file?

The default architecture for Visual Studio generators on Win64 systems is x64. To build 32bit DLL files you need to add -A Win32 to your CMake command line.

I don’t believe this is true for older VS generators (including 2008).

CMake only generates the project to make the library. You can use cmake --build . --config Release to build the project (replace Release with Debug if you want such a build).

You are right. I mixed that up with newer Visual Studio generators.

So how do I use the project made by cmake to create a new library DLL out of my “OptickCore.dll” after the project is made?

The cmake --build . command I gave above should do.