1 # Require at least version 2.8.12 of CMake
2 cmake_minimum_required(VERSION 2.8.12)
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 "")
12 set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform)
14 add_definitions(-DWINDOWS=1)
16 if (DEFINED ENV{__ToolsetDir})
17 # Hack for private Tool Set
18 # CMAKE_CXX_COMPILER will default to the compiler installed with
19 # Visual studio. Overwrite it to the compiler on the path.
21 find_program(PATH_CXX_COMPILER cl)
22 set(CMAKE_CXX_COMPILER ${PATH_CXX_COMPILER})
24 message("Overwriting the CMAKE_CXX_COMPILER.")
25 message("CMAKE_CXX_COMPILER found:${CMAKE_CXX_COMPILER}")
27 # Temporary until cmake has VS generators for hacky toolsets [arm64]
28 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
29 set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
30 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
37 add_compile_options(-wd4100 -wd4514 -wd4668 -wd4710 -wd4711 -wd4820)
40 if(CLR_CMAKE_PLATFORM_UNIX)
41 add_compile_options(-fPIC)
42 endif(CLR_CMAKE_PLATFORM_UNIX)
44 MACRO(SUBDIRLIST result curdir)
45 FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
47 FOREACH(child ${children})
48 IF(IS_DIRECTORY ${curdir}/${child})
49 LIST(APPEND dirlist ${child})
52 SET(${result} ${dirlist})
55 MACRO(ADDSUBDIR_REC curdir)
56 SUBDIRLIST(SUB_DIRS ${curdir})
57 FOREACH(subdir ${SUB_DIRS})
58 if(EXISTS "${curdir}/${subdir}/CMakeLists.txt")
59 ADD_SUBDIRECTORY(${curdir}/${subdir})
61 ADDSUBDIR_REC(${curdir}/${subdir})
62 endif(EXISTS "${curdir}/${subdir}/CMakeLists.txt")
66 ADDSUBDIR_REC(${CMAKE_CURRENT_SOURCE_DIR})