Merge branch 'release/3.0' into merge/master-to-release/3.0
[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 (NOT WIN32)
5   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
6   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
7 endif()
8
9 set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform)
10 if (WIN32)
11     add_definitions(-DWINDOWS=1)
12 endif()
13
14 # Verify that LTCG/LTO is available
15 include(${CMAKE_CURRENT_SOURCE_DIR}/../configure.cmake)
16 # Include global configure settings
17 include(${CMAKE_CURRENT_SOURCE_DIR}/../configurecompiler.cmake)
18 # Compile options
19
20 if (WIN32)
21     # 4100 - unreferenced formal parameter
22     # 4514 - unreferenced inline function has been removed
23     # 4625 - copy constructor was implicitly defined as deleted because a base class copy constructor is inaccessible or deleted
24     # 4626 - assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted
25     # 4668 - 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'
26     # 4710 - function not inlined
27     # 4711 - 'function' selected for inline expansion
28     # 4774 - format string expected in argument number is not a string literal
29     # 4820 - bytes padding added after construct 'member_name'
30     # 5025 - move assignment operator was implicitly defined as deleted
31     # 5026 - move constructor was implicitly defined as deleted
32     # 5027 - move assignment operator was implicitly defined as deleted
33     # 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.
34     add_compile_options(-wd4100 -wd4514 -wd4625 -wd4626 -wd4668 -wd4710 -wd4711 -wd4774 -wd4820 -wd5025 -wd5026 -wd5027 -wd5039)
35     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
36 endif()
37
38 if(CLR_CMAKE_PLATFORM_UNIX)
39     add_compile_options(-fPIC)
40 endif(CLR_CMAKE_PLATFORM_UNIX)
41
42 MACRO(SUBDIRLIST result curdir)
43   FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
44   SET(dirlist "")
45   FOREACH(child ${children})
46     IF(IS_DIRECTORY ${curdir}/${child})
47         LIST(APPEND dirlist ${child})
48     ENDIF()
49   ENDFOREACH()
50   SET(${result} ${dirlist})
51 ENDMACRO()
52
53 MACRO(ADDSUBDIR_REC  curdir)
54     SUBDIRLIST(SUB_DIRS ${curdir})
55     FOREACH(subdir ${SUB_DIRS})
56         if(EXISTS "${curdir}/${subdir}/CMakeLists.txt")
57            ADD_SUBDIRECTORY(${curdir}/${subdir})
58         else()
59            ADDSUBDIR_REC(${curdir}/${subdir})
60         endif(EXISTS "${curdir}/${subdir}/CMakeLists.txt")
61     ENDFOREACH()
62 ENDMACRO()
63
64 ADDSUBDIR_REC(${CMAKE_CURRENT_SOURCE_DIR})