2012年10月22日 星期一

[CMake] Some settings for VS project file

This is a simple note that showing some statement in CMakeList.txt to configure setting of VS project.

To add Preprocessor Definitions.
add_definitions(-DNOENTRY)










To add Additional Include Directories.

INCLUDE_DIRECTORIES(${VCInstallDir}/include/sys)










To modify Runtime Library.
STRING(REPLACE "/MTd" "/MDd" CMAKE_CXX_FLAGS_DEBUG
${CMAKE_CXX_FLAGS_DEBUG})
STRING(REPLACE "/MT" "/MD" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
STRING(REPLACE "/MT" "/MD" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
STRING(REPLACE "/MT" "/MD" CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL})








To Exclude Build Project from solution.
If project is added by this line add_library(foo EXCLUDE_FROM_ALL foo.c)
Add statement below to exclude project from build.
set_target_properties(foo PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)



沒有留言:

張貼留言