-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
63 lines (50 loc) · 1.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
cmake_minimum_required (VERSION 2.6)
project (mml)
include_directories("${PROJECT_SOURCE_DIR}")
# are we using the intel compiler
set(USING_INTEL)
if (WIN32 AND CMAKE_C_COMPILER AND ${CMAKE_C_COMPILER} MATCHES ".*icl.*$")
message(STATUS "Detected Intel Compiler")
set(USING_INTEL TRUE)
endif ()
# if using msvc or intel windows compiler allow for the use of the static runtime
if(MSVC OR USING_INTEL)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
set(BUILD_DEFINITIONS "${BUILD_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS")
option(WITH_STATIC_RUNTIME "Compile using the static MSVC Runtime." OFF)
if(WITH_STATIC_RUNTIME)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
add_definitions( -D_MT)
endif(WITH_STATIC_RUNTIME)
endif(MSVC OR USING_INTEL)
# compile as position independent code
if (UNIX OR CYGWIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
set(SOURCES qtmmlwidget.cpp)
set(HEADERS qtmmlwidget.h)
include(${CMAKE_CURRENT_SOURCE_DIR}/ChooseQtVersion.cmake)
QT_FIND_MODULES(Core OpenGL Xml)
if (Qt5_FOUND)
qt5_wrap_cpp(HEADERS_MOC ${HEADERS})
set(QTVERSION 5)
elseif(Qt4_FOUND OR QT4_FOUND)
qt4_wrap_cpp(HEADERS_MOC ${HEADERS})
endif()
add_library(mml STATIC ${SOURCES} ${HEADERS} ${HEADERS_MOC})
QT_BIND_TO_TARGET(mml)
install(FILES ${HEADERS} DESTINATION include)
INSTALL(TARGETS mml
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)