summaryrefslogtreecommitdiffstats
path: root/Source/MFCDialog/CMakeLists.txt
blob: e48e744f5066424bcdde2a80e4356f6a1afb7704 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
SET( SRCS 
  CMakeSetup.h
  CMakeSetup.cpp
  MakeHelp.h
  MakeHelp.cpp
  CMakeGenDialog.h
  CMakeGenDialog.cpp
  CMakeSetup.rc
  CMakeSetupDialog.h
  CMakeSetupDialog.cpp
  PathDialog.h
  PathDialog.cpp
  PropertyList.cpp
  StdAfx.h
  StdAfx.cpp
  resource.h
  CMakeCommandLineInfo.cpp
)

# add stuff to use MFC in this executable
ADD_DEFINITIONS(-D_AFXDLL)

# Use of CMAKE_MFC_FLAG 
# Values: 
# 0: Use Standard Windows Libraries 
# 1: Use MFC in a Static Library 
# 2: Use MFC in a Shared DLL 
SET(CMAKE_MFC_FLAG 2)

ADD_EXECUTABLE(CMakeSetup WIN32 ${SRCS})
TARGET_LINK_LIBRARIES(CMakeSetup CMakeLib)
ADD_DEPENDENCIES(CMakeSetup cmake)

IF(MSVC AND NOT MSVC60 AND NOT MSVC70 AND NOT MSVC71)
  SET(exe "${CMAKE_CFG_INTDIR}/CMakeSetup.exe")
  IF(EXECUTABLE_OUTPUT_PATH)
    SET(exe "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/CMakeSetup.exe")
  ENDIF(EXECUTABLE_OUTPUT_PATH)

  # VERBATIM flag should be avoided if building with Visual Studio.
  # (OK to add the flag if ${CMAKE_CFG_INTDIR} is "." which is one
  # indicator that you are not building with Visual Studio.)
  #
  SET(verbatim_flag)
  IF("${CMAKE_CFG_INTDIR}" STREQUAL ".")
    # VERBATIM flag should also be avoided if using an older CMake.
    # VERBATIM flag support was added in CMake 2.4.5
    #
    IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 2.4)
      IF(${CMAKE_PATCH_VERSION} GREATER 4)
        SET(verbatim_flag "VERBATIM")
      ENDIF(${CMAKE_PATCH_VERSION} GREATER 4)
    ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 2.4)

    IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
      SET(verbatim_flag "VERBATIM")
    ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)

    IF(NOT verbatim_flag)
      MESSAGE("${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): warning
        warning: The VERBATIM flag for ADD_CUSTOM_COMMAND may be required to execute mt correctly,
                 but you are using a CMake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} which does not parse the VERBATIM flag.
                 Upgrade to CMake 2.4.5 or later to eliminate this warning.")
    ENDIF(NOT verbatim_flag)
  ENDIF("${CMAKE_CFG_INTDIR}" STREQUAL ".")

  # Solve the "things named like *Setup prompt for admin privileges
  # on Vista" problem by merging a manifest fragment that contains a
  # requestedExecutionLevel element:
  #
  ADD_CUSTOM_COMMAND(TARGET CMakeSetup
    POST_BUILD COMMAND mt
    "-inputresource:${exe};#1"
    -manifest "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetupManifest.xml"
    "-outputresource:${exe};#1"
    ${verbatim_flag}
  )
ENDIF(MSVC AND NOT MSVC60 AND NOT MSVC70 AND NOT MSVC71)

INSTALL_TARGETS(/bin CMakeSetup)