Integration with CMake
The following two ways are described how to use Testwell CTC++ with CMake: By defining a switch in one of the CMakeLists.txt files, or by using ctclaunch.
With ctclaunch
See this example of the ctclaunch description.
By configuring CMakeLists.txt
In a CMakeLists.txt, add the following lines to set a switch
CMAKE_ENABLE_CTC
for the instrumentation with ctc:
if(CMAKE_ENABLE_CTC)
set(CTC_OPTIONS "-i m -v")
set(CMAKE_C_COMPILER_ARG1 "${CTC_OPTIONS} \"${CMAKE_C_COMPILER}\"")
set(CMAKE_C_COMPILER "ctc")
string(REGEX REPLACE "<CMAKE_LINKER>"
"c:/testwell/ctc/ctc.exe ${CTC_OPTIONS} <CMAKE_LINKER>"
CMAKE_C_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})
message( "~~~ CMAKE_C_COMPILER now:" "${CMAKE_C_COMPILER}")
message( "~~~ CMAKE_C_COMPILER_ARG1 now:" "${CMAKE_C_COMPILER_ARG1}")
message( "~~~ CMAKE_C_LINK_EXECUTABLE now:" ${CMAKE_C_LINK_EXECUTABLE})
endif()
If you are using C++, you have to replace _C_
with _CXX_
.
Note: This is just the general idea how the integration works. With the flexibility of CMake, it heavily depends on the actual setup.