[CMake] How to set MS Visual Studio Project Properties

Brad King brad.king at kitware.com
Fri Jun 17 10:19:03 EDT 2005


Craig Davis wrote:
> Hello all,
> 
> I was wondering if anyone knows if it is possible to set any of the
> following project properties using CMake rather than having to manually
> set them after the project is built:
> 
> Tab        Category          Field                                      
> Value
> ----------------------------------------------------------------------------------------------
> C/C++   Preprocessor     Preprocessor definitions          
> MATLAB_MEX_FILE

For a whole project:

ADD_DEFINITIONS(-DMATLAB_MEX_FILE)

or for an individual source file:

SET_SOURCE_FILES_PROPERTIES(mymex.c PROPERTIES
   COMPILE_FLAGS -DMATLAB_MEX_FILE)

> C/C++   Preprocessor     Additional include directories    C:\MATLAB701

INCLUDE_DIRECTORIES command

> Link       Input               Object/library modules            
> libmex.lib libmx.lib

TARGET_LINK_LIBRARIES

> Link       Input               Additional Library Path            
> C:\MATLAB701

LINK_DIRECTORIES

> Link      (any)                Project Options                   
> /EXPORT:mexFunction

Use __declspec(dllexport) in the code.

-Brad



More information about the CMake mailing list