17 CMakeCommandLineInfo.cpp
20 # add stuff to use MFC in this executable
21 ADD_DEFINITIONS(-D_AFXDLL)
23 # Use of CMAKE_MFC_FLAG
25 # 0: Use Standard Windows Libraries
26 # 1: Use MFC in a Static Library
27 # 2: Use MFC in a Shared DLL
30 ADD_EXECUTABLE(CMakeSetup WIN32 ${SRCS})
31 TARGET_LINK_LIBRARIES(CMakeSetup CMakeLib)
32 ADD_DEPENDENCIES(CMakeSetup cmake)
35 # some older versions of cmake do not have
36 # a patch version set so we need to set it
37 # so that a later if will not fail, this has
38 # to be done all the time for all generators
39 # since if statements are evaluated even if
40 # inside a false if, they must still parse so for
41 # if (CMAKE_PATCH_VERSION GREATER 4) not to
42 # fail CMAKE_PATCH_VERSION must be set
43 IF(${CMAKE_MAJOR_VERSION} LESS 3)
44 IF(NOT DEFINED CMAKE_PATCH_VERSION)
45 SET(CMAKE_PATCH_VERSION 0)
46 ENDIF(NOT DEFINED CMAKE_PATCH_VERSION)
47 ENDIF(${CMAKE_MAJOR_VERSION} LESS 3)
49 # for MSVC greater than 71 assume mt is around
50 # for other versions allow for the cache to be
51 # seeded with a value for CMAKE_MT_EXECUTABLE
52 # this allows for MSVC71 to build CMakeSetup that
53 # will have the manifest stuff for windows vista
54 IF(MSVC AND NOT MSVC60 AND NOT MSVC70 AND NOT MSVC71)
55 SET(CMAKE_MT_EXECUTABLE mt)
56 ENDIF(MSVC AND NOT MSVC60 AND NOT MSVC70 AND NOT MSVC71)
57 IF(CMAKE_MT_EXECUTABLE)
58 SET(exe "${CMAKE_CFG_INTDIR}/CMakeSetup.exe")
59 IF(EXECUTABLE_OUTPUT_PATH)
60 SET(exe "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/CMakeSetup.exe")
61 ENDIF(EXECUTABLE_OUTPUT_PATH)
63 # VERBATIM flag should be avoided if building with Visual Studio.
64 # (OK to add the flag if ${CMAKE_CFG_INTDIR} is "." which is one
65 # indicator that you are not building with Visual Studio.)
68 IF(NOT CMAKE_CONFIGURATION_TYPES)
69 # VERBATIM flag should also be avoided if using an older CMake.
70 # VERBATIM flag support was added in CMake 2.4.5
72 IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 2.4)
73 IF(${CMAKE_PATCH_VERSION} GREATER 4)
74 SET(verbatim_flag "VERBATIM")
75 ENDIF(${CMAKE_PATCH_VERSION} GREATER 4)
76 ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 2.4)
78 IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
79 SET(verbatim_flag "VERBATIM")
80 ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
83 MESSAGE("${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): warning
84 warning: The VERBATIM flag for ADD_CUSTOM_COMMAND may be required to execute mt correctly,
85 but you are using a CMake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} which does not parse the VERBATIM flag.
86 Upgrade to CMake 2.4.5 or later to eliminate this warning.")
87 ENDIF(NOT verbatim_flag)
88 ENDIF(NOT CMAKE_CONFIGURATION_TYPES)
90 SET(_CMAKE_INPUT_RESOURCE "-inputresource:${exe};#1")
91 # if msvc71 then you can not replace the resource
92 # but you can add one, so set the input resource to empty
94 SET(_CMAKE_INPUT_RESOURCE )
96 # Solve the "things named like *Setup prompt for admin privileges
97 # on Vista" problem by merging a manifest fragment that contains a
98 # requestedExecutionLevel element:
100 ADD_CUSTOM_COMMAND(TARGET CMakeSetup
101 POST_BUILD COMMAND mt
102 "${_CMAKE_INPUT_RESOURCE}"
103 -manifest "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetupManifest.xml"
104 "-outputresource:${exe};#1"
107 ENDIF(CMAKE_MT_EXECUTABLE)
109 INSTALL_TARGETS(/bin CMakeSetup)