Skip to content

A collection of CMake utility functions for environment setting for Visual C++, CMake for google test

License

Notifications You must be signed in to change notification settings

yangcha/cmake-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmake-modules

A collection of CMake utility functions for setting runtime library paths, environmental variables, working directory for Visual C++. And function for adding unit tests using google test with cmake.

   SET_PROGRAM_ENV(<name>
	[WORKING_DIRECTORY <dir>]
	[RUNTIME_DIRS <dirs>...]
	[ENVIRONMENT <VAR=value>...]
	[COMMAND_ARGS <value>]
	)

The WORKING_DIRECTORY specifies the program working directory. RUNTIME_DIRS specifies the dynamic library directories. ENVIRONMENT sets the environmental variables and command arguments. See the following example:

include(SetProgramEnv)

set_program_env( Example1
	WORKING_DIRECTORY
	"${CMAKE_BINARY_DIR}/bin"
	RUNTIME_DIRS
	"${CMAKE_BINARY_DIR}/bin"
	"C:\\Users\\Documents\\Visual Studio 2010"
	ENVIRONMENT
	"BINROOT=${CMAKE_BINARY_DIR}"
	"SRCROOT=${CMAKE_SOURCE_DIR}"
	COMMAND_ARGS
	"input output"
	)

To add an unit test with Google test, use function:

  ADD_GTEST(<name>
            source1 [source2 ...])

See the following example to add unit test using cmake with google test framework:

include(gtest)
add_gtest(unitTest test_example.cpp)

About

A collection of CMake utility functions for environment setting for Visual C++, CMake for google test

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages