Merge pull request #18223 from mikedn/inc-codegen
[platform/upstream/coreclr.git] / tests / CMakeLists.txt
1 # Require at least version 2.8.12 of CMake
2 cmake_minimum_required(VERSION 2.8.12)
3
4 if (CMAKE_CONFIGURATION_TYPES) # multi-configuration generator?
5     set(CMAKE_CONFIGURATION_TYPES "Debug;Checked;Release;RelWithDebInfo" CACHE STRING "" FORCE)
6 endif (CMAKE_CONFIGURATION_TYPES)
7 set(CMAKE_C_FLAGS_CHECKED "")
8 set(CMAKE_CXX_FLAGS_CHECKED "")
9 set(CMAKE_EXE_LINKER_FLAGS_CHECKED "")
10 set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
11
12 set(CLR_CMAKE_TARGET_ARCH ${CLR_CMAKE_HOST_ARCH})
13
14 set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform)
15 if (WIN32)
16     add_definitions(-DWINDOWS=1)
17 endif()
18
19 # Compile options
20
21 if (WIN32)
22     # 4100 - unreferenced formal parameter
23     # 4514 - unreferenced inline function has been removed
24     # 4625 - copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
25     # 4626 - assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
26     # 4668 - 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'
27     # 4710 - function not inlined
28     # 4711 - 'function' selected for inline expansion
29     # 4774 - format string expected in argument number is not a string literal
30     # 4820 - bytes padding added after construct 'member_name'
31     # 5025 - move assignment operator was implicitly defined as deleted
32     # 5026 - move constructor was implicitly defined as deleted
33     # 5027 - move assignment operator was implicitly defined as deleted
34     # 5039 - pointer or reference to potentially throwing function passed to extern C function under -EHc. Undefined behavior may occur if this function throws an exception.
35     add_compile_options(-wd4100 -wd4514 -wd4625 -wd4626 -wd4668 -wd4710 -wd4711 -wd4774 -wd4820 -wd5025 -wd5026 -wd5027 -wd5039)
36     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
37 endif()
38
39 if(CLR_CMAKE_PLATFORM_UNIX)
40     add_compile_options(-fPIC)
41 endif(CLR_CMAKE_PLATFORM_UNIX)
42
43 MACRO(SUBDIRLIST result curdir)
44   FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
45   SET(dirlist "")
46   FOREACH(child ${children})
47     IF(IS_DIRECTORY ${curdir}/${child})
48         LIST(APPEND dirlist ${child})
49     ENDIF()
50   ENDFOREACH()
51   SET(${result} ${dirlist})
52 ENDMACRO()
53
54 MACRO(ADDSUBDIR_REC  curdir)
55     SUBDIRLIST(SUB_DIRS ${curdir})
56     FOREACH(subdir ${SUB_DIRS})
57         if(EXISTS "${curdir}/${subdir}/CMakeLists.txt")
58            ADD_SUBDIRECTORY(${curdir}/${subdir})
59         else()
60            ADDSUBDIR_REC(${curdir}/${subdir})
61         endif(EXISTS "${curdir}/${subdir}/CMakeLists.txt")
62     ENDFOREACH()
63 ENDMACRO()
64
65 ADDSUBDIR_REC(${CMAKE_CURRENT_SOURCE_DIR})