Debian Codegraph @

src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/testtools/micromock/CMakeLists.txt

raw
1 #Copyright (c) Microsoft. All rights reserved.
2 #Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4 #this is CMakeLists for micromock
5 cmake_minimum_required (VERSION 3.5)
6
7 set(micromock_cpp_files
8 ./src/micromockcharstararenullterminatedstrings.cpp
9 ./src/micromockexception.cpp
10 ./src/micromocktestmutex.cpp
11 ./src/mockcallrecorder.cpp
12 ./src/mockmethodcallbase.cpp
13 ./src/mockvaluebase.cpp
14 ./src/timediscretemicromock.cpp
15 )
16
17 set(micromock_h_files
18 ./inc/globalmock.h
19 ./inc/micromock.h
20 ./inc/micromockcallmacros.h
21 ./inc/micromockcharstararenullterminatedstrings.h
22 ./inc/micromockcommon.h
23 ./inc/micromockenumtostring.h
24 ./inc/micromockexception.h
25 ./inc/micromocktestmutex.h
26 ./inc/micromocktestrunnerhooks.h
27 ./inc/mock.h
28 ./inc/mockcallargument.h
29 ./inc/mockcallargumentbase.h
30 ./inc/mockcallcomparer.h
31 ./inc/mockcallrecorder.h
32 ./inc/mockmethodcall.h
33 ./inc/mockmethodcallbase.h
34 ./inc/mockresultvalue.h
35 ./inc/mockvalue.h
36 ./inc/mockvaluebase.h
37 ./inc/nicecallcomparer.h
38 ./inc/runtimemock.h
39 ./inc/stdafx.h
40 ./inc/strictorderedcallcomparer.h
41 ./inc/strictunorderedcallcomparer.h
42 ./inc/targetver.h
43 ./inc/threadsafeglobalmock.h
44 ./inc/timediscretemicromock.h
45 ./inc/timediscretemicromockcallmacros.h
46 )
47
48 string(REPLACE "./inc/" ";./testtools/micromock/inc/" FILES_TO_INSTALL ${micromock_h_files})
49 set(micromock_h_files_full_path "${FILES_TO_INSTALL}" CACHE INTERNAL "")
50 add_files_to_install("${FILES_TO_INSTALL}")
51
52 include_directories(${SHARED_UTIL_INC_FOLDER})
53
54 IF(WIN32)
55 #windows needs this define
56 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
57
58 if (${use_cppunittest})
59 #windows needs to be build 2 flavor of micromock, one for CTEST reporting, one for CPP_UNITTEST
60 add_library(micromock_cpp_unittest ${micromock_cpp_files} ${micromock_h_files})
61 target_compile_definitions(micromock_cpp_unittest PUBLIC CPP_UNITTEST)
62 target_compile_options(micromock_cpp_unittest PUBLIC /EHsc)
63
64 if(EXISTS "$ENV{VCInstallDir}/UnitTest/include")
65 #flip VCInstallDir path
66 file(TO_CMAKE_PATH $ENV{VCInstallDir} VCInstallDir)
67 #pre-VS2017 build environment doesn't appear to include the path to unit
68 #test headers, so add it here
69 target_include_directories(micromock_cpp_unittest PUBLIC ${VCInstallDir}/UnitTest/include)
70 endif()
71
72 set_target_properties(micromock_cpp_unittest
73 PROPERTIES
74 FOLDER "test_tools")
75 endif()
76
77 add_library(micromock_ctest ${micromock_cpp_files} ${micromock_h_files})
78 target_compile_definitions(micromock_ctest PUBLIC USE_CTEST)
79 target_compile_options(micromock_ctest PUBLIC /EHsc)
80 else()
81 add_library(micromock_ctest ${micromock_cpp_files} ${micromock_h_files})
82 target_compile_definitions(micromock_ctest PUBLIC USE_CTEST)
83 ENDIF()
84
85 set_target_properties(micromock_ctest
86 PROPERTIES
87 FOLDER "test_tools")
88
89 #these are the include folders
90 #the following "set" statetement exports across the project a global variable called MICROMOCK_INC_FOLDER that expands to whatever needs to included when using micromock library
91 set(MICROMOCK_INC_FOLDER ${CMAKE_CURRENT_LIST_DIR}/inc CACHE INTERNAL "this is what needs to be included if using micromock lib" FORCE)
92
93 include_directories(${TESTRUNNERSWITCHER_INC_FOLDER} ${CTEST_INC_FOLDER} ${SAL_INC_FOLDER} ${MICROMOCK_INC_FOLDER} )
94 include_directories(${TESTRUNNERSWITCHER_INCLUDES} ${CTEST_INCLUDES} ${UMOCK_C_INCLUDES})
95
96 if (${run_unittests})
97 add_subdirectory(unittests)
98 endif()
99
100 if(${use_installed_dependencies})
101 if(WIN32)
102 install (TARGETS micromock_cpp_unittest EXPORT aziotsharedutilTargets DESTINATION lib)
103 endif()
104 install (TARGETS micromock_ctest EXPORT aziotsharedutilTargets DESTINATION lib)
105 endif()
106
107 if(WIN32)
108 add_executable(micromock_generator ./tools/micromockgenerator/micromockgenerator.cpp)
109
110 target_compile_options(micromock_generator PUBLIC /EHsc)
111
112 set_target_properties(micromock_generator
113 PROPERTIES
114 FOLDER "test_tools")
115 endif()
116
117 if (CMAKE_VERSION VERSION_LESS "3.1")
118 if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
119 if (CXX_FLAG_CXX11)
120 set_source_files_properties(${micromock_cpp_files} PROPERTIES COMPILE_FLAGS "-std=c++11")
121 else()
122 set_source_files_properties(${micromock_cpp_files} PROPERTIES COMPILE_FLAGS "-std=c++0x")
123 endif()
124 endif()
125 else()
126 if (TARGET micromock_cpp_unittest)
127 compileTargetAsC11(micromock_cpp_unittest)
128 endif()
129 if (TARGET micromock_ctest)
130 compileTargetAsC11(micromock_ctest)
131 endif()
132 endif()