Merge branch 'master' into osx-CFBundle-info-plist

Resolve conflict in Source/cmOSXBundleGenerator.cxx by taking
the side from 'master'.
This commit is contained in:
Brad King 2014-04-22 12:51:55 -04:00
commit e4e76f286c
772 changed files with 10916 additions and 7464 deletions

View File

@ -21,7 +21,9 @@ if(CMAKE_BOOTSTRAP)
unset(CMAKE_BOOTSTRAP CACHE) unset(CMAKE_BOOTSTRAP CACHE)
endif() endif()
set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) if(NOT CMake_TEST_EXTERNAL_CMAKE)
set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin)
endif()
if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# Disallow architecture-specific try_run. It may not run on the host. # Disallow architecture-specific try_run. It may not run on the host.
@ -34,6 +36,13 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
endmacro() endmacro()
endif() endif()
# option to set the internal encoding of CMake to UTF-8
option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally (experimental)." OFF)
mark_as_advanced(CMAKE_ENCODING_UTF8)
if(CMAKE_ENCODING_UTF8)
set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
endif()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# a macro to deal with system libraries, implemented as a macro # a macro to deal with system libraries, implemented as a macro
# simply to improve readability of the main script # simply to improve readability of the main script
@ -102,9 +111,11 @@ endmacro()
set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) if(NOT CMake_TEST_EXTERNAL_CMAKE)
if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) set(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW )
set(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
endif()
endif() endif()
@ -114,29 +125,6 @@ endif()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
macro(CMAKE_SETUP_TESTING) macro(CMAKE_SETUP_TESTING)
if(BUILD_TESTING) if(BUILD_TESTING)
set(CMAKE_TEST_GENERATOR "" CACHE STRING
"Generator used when running tests")
set(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH
"Generator used when running tests")
if(NOT CMAKE_TEST_GENERATOR)
set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}")
set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}")
else()
set(CMAKE_TEST_DIFFERENT_GENERATOR TRUE)
set(CMAKE_TEST_GENERATOR_TOOLSET "")
endif()
# Are we testing with the MSVC compiler?
set(CMAKE_TEST_MSVC 0)
if(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
set(CMAKE_TEST_MSVC 1)
else()
if("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
"${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
set(CMAKE_TEST_MSVC 1)
endif()
endif()
set(CMAKE_TEST_SYSTEM_LIBRARIES 0) set(CMAKE_TEST_SYSTEM_LIBRARIES 0)
foreach(util CURL EXPAT XMLRPC ZLIB) foreach(util CURL EXPAT XMLRPC ZLIB)
if(CMAKE_USE_SYSTEM_${util}) if(CMAKE_USE_SYSTEM_${util})
@ -149,9 +137,19 @@ macro(CMAKE_SETUP_TESTING)
# the ctest from this cmake is used for testing # the ctest from this cmake is used for testing
# and not the ctest from the cmake building and testing # and not the ctest from the cmake building and testing
# cmake. # cmake.
set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") if(CMake_TEST_EXTERNAL_CMAKE)
set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") set(CMAKE_CTEST_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/ctest")
set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") set(CMAKE_CMAKE_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cmake")
set(CMAKE_CPACK_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cpack")
foreach(exe cmake ctest cpack)
add_executable(${exe} IMPORTED)
set_property(TARGET ${exe} PROPERTY IMPORTED_LOCATION ${CMake_TEST_EXTERNAL_CMAKE}/${exe})
endforeach()
else()
set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest")
set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake")
set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack")
endif()
endif() endif()
# configure some files for testing # configure some files for testing
@ -164,8 +162,6 @@ macro(CMAKE_SETUP_TESTING)
${CMake_BINARY_DIR}/Modules/.NoDartCoverage) ${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in
${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY) ${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY)
configure_file(${CMake_SOURCE_DIR}/CTestCustom.ctest.in
${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY)
if(BUILD_TESTING AND DART_ROOT) if(BUILD_TESTING AND DART_ROOT)
configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif
${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY) ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
@ -387,18 +383,20 @@ macro (CMAKE_BUILD_UTILITIES)
endmacro () endmacro ()
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") if(NOT CMake_TEST_EXTERNAL_CMAKE)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
${CMAKE_CXX_COMPILER_ARG1} -dumpversion execute_process(COMMAND ${CMAKE_CXX_COMPILER}
OUTPUT_VARIABLE _GXX_VERSION ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
) OUTPUT_VARIABLE _GXX_VERSION
string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" )
_GXX_VERSION_SHORT ${_GXX_VERSION}) string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
if(_GXX_VERSION_SHORT EQUAL 33) _GXX_VERSION_SHORT ${_GXX_VERSION})
message(FATAL_ERROR if(_GXX_VERSION_SHORT EQUAL 33)
"GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n" message(FATAL_ERROR
"Please use GXX 4.2 or greater to build CMake on OpenBSD\n" "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n"
"${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}") "Please use GXX 4.2 or greater to build CMake on OpenBSD\n"
"${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}")
endif()
endif() endif()
endif() endif()
@ -417,31 +415,33 @@ include (${CMAKE_ROOT}/Modules/Dart.cmake)
set_directory_properties(PROPERTIES set_directory_properties(PROPERTIES
TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake") TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake")
# where to write the resulting executables and libraries if(NOT CMake_TEST_EXTERNAL_CMAKE)
set(BUILD_SHARED_LIBS OFF) # where to write the resulting executables and libraries
set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.") set(BUILD_SHARED_LIBS OFF)
set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.")
"Where to put the libraries for CMake") set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
"Where to put the libraries for CMake")
# The CMake executables usually do not need any rpath to run in the build or # The CMake executables usually do not need any rpath to run in the build or
# install tree. # install tree.
set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
# Load install destinations. # Load install destinations.
include(Source/CMakeInstallDestinations.cmake) include(Source/CMakeInstallDestinations.cmake)
if(BUILD_TESTING) if(BUILD_TESTING)
include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake) include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
endif()
# include special compile flags for some compilers
include(CompileFlags.cmake)
# no clue why we are testing for this here
include(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
endif() endif()
# include special compile flags for some compilers
include(CompileFlags.cmake)
# no clue why we are testing for this here
include(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
# CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests. # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests.
# #
# If not defined or "", this variable defaults to the server at # If not defined or "", this variable defaults to the server at
@ -459,70 +459,73 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash")
endif() endif()
# build the utilities (a macro defined in this file) if(NOT CMake_TEST_EXTERNAL_CMAKE)
CMAKE_BUILD_UTILITIES() # build the utilities (a macro defined in this file)
CMAKE_BUILD_UTILITIES()
# On NetBSD ncurses is required, since curses doesn't have the wsyncup() # On NetBSD ncurses is required, since curses doesn't have the wsyncup()
# function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib, # function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib,
# which isn't in the default linker search path. So without RPATH ccmake # which isn't in the default linker search path. So without RPATH ccmake
# doesn't run and the build doesn't succeed since ccmake is executed for # doesn't run and the build doesn't succeed since ccmake is executed for
# generating the documentation. # generating the documentation.
if(BUILD_CursesDialog) if(BUILD_CursesDialog)
get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH) get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
set(CURSES_NEED_RPATH FALSE) set(CURSES_NEED_RPATH FALSE)
if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64") if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
set(CURSES_NEED_RPATH TRUE) set(CURSES_NEED_RPATH TRUE)
endif()
endif()
if(BUILD_QtDialog)
if(APPLE)
set(CMAKE_BUNDLE_VERSION
"${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
# make sure CMAKE_INSTALL_PREFIX ends in /
string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
math(EXPR LEN "${LEN} -1" )
string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
if(NOT "${ENDCH}" STREQUAL "/")
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
endif() endif()
set(CMAKE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}CMake.app/Contents")
endif() endif()
set(QT_NEED_RPATH FALSE) if(BUILD_QtDialog)
if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64") if(APPLE)
set(QT_NEED_RPATH TRUE) set(CMAKE_BUNDLE_VERSION
"${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
# make sure CMAKE_INSTALL_PREFIX ends in /
string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
math(EXPR LEN "${LEN} -1" )
string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
if(NOT "${ENDCH}" STREQUAL "/")
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
endif()
set(CMAKE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}CMake.app/Contents")
endif()
set(QT_NEED_RPATH FALSE)
if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
set(QT_NEED_RPATH TRUE)
endif()
endif() endif()
# The same might be true on other systems for other libraries.
# Then only enable RPATH if we have are building at least with cmake 2.4,
# since this one has much better RPATH features than cmake 2.2.
# The executables are then built with the RPATH for the libraries outside
# the build tree, which is both the build and the install RPATH.
if (UNIX)
if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB
OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH)
set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()
endif ()
# add the uninstall support
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
include (CMakeCPack.cmake)
endif() endif()
# The same might be true on other systems for other libraries.
# Then only enable RPATH if we have are building at least with cmake 2.4,
# since this one has much better RPATH features than cmake 2.2.
# The executables are then built with the RPATH for the libraries outside
# the build tree, which is both the build and the install RPATH.
if (UNIX)
if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB
OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH)
set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()
endif ()
# add the uninstall support
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
include (CMakeCPack.cmake)
# setup some Testing support (a macro defined in this file) # setup some Testing support (a macro defined in this file)
CMAKE_SETUP_TESTING() CMAKE_SETUP_TESTING()
configure_file( configure_file(
@ -530,62 +533,69 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf" "${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf"
COPYONLY) COPYONLY)
if(NOT CMake_VERSION_IS_RELEASE) if(NOT CMake_TEST_EXTERNAL_CMAKE)
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND if(NOT CMake_VERSION_IS_RELEASE)
NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND
set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
-Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
-Wmissing-format-attribute -fno-common -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
) -Wmissing-format-attribute -fno-common -Wundef
set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W )
-Wshadow -Wpointer-arith -Wformat-security -Wundef set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
) -Wshadow -Wpointer-arith -Wformat-security -Wundef
)
foreach(FLAG_LANG C CXX) foreach(FLAG_LANG C CXX)
foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST}) foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST})
if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ") if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ")
set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}") set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}")
endif() endif()
endforeach()
endforeach() endforeach()
endforeach()
unset(C_FLAGS_LIST) unset(C_FLAGS_LIST)
unset(CXX_FLAGS_LIST) unset(CXX_FLAGS_LIST)
endif()
endif() endif()
# build the remaining subdirectories
add_subdirectory(Source)
add_subdirectory(Utilities)
endif() endif()
# build the remaining subdirectories
add_subdirectory(Source)
add_subdirectory(Utilities)
add_subdirectory(Tests) add_subdirectory(Tests)
if(BUILD_TESTING) if(NOT CMake_TEST_EXTERNAL_CMAKE)
CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests") if(BUILD_TESTING)
endif() CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests")
CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat") endif()
if(TARGET documentation) CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat")
CMAKE_SET_TARGET_FOLDER(documentation "Documentation") if(TARGET documentation)
CMAKE_SET_TARGET_FOLDER(documentation "Documentation")
endif()
endif() endif()
# add a test # add a test
add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
--system-information -G "${CMAKE_TEST_GENERATOR}" ) --system-information -G "${CMAKE_GENERATOR}" )
# Install license file as it requires. if(NOT CMake_TEST_EXTERNAL_CMAKE)
install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}) # Install license file as it requires.
install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR})
# Install script directories. # Install script directories.
install( install(
DIRECTORY Help Modules Templates DIRECTORY Help Modules Templates
DESTINATION ${CMAKE_DATA_DIR} DESTINATION ${CMAKE_DATA_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE WORLD_READ WORLD_EXECUTE
PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
GROUP_READ GROUP_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE WORLD_READ WORLD_EXECUTE
) )
# Install auxiliary files integrating with other tools. # Install auxiliary files integrating with other tools.
add_subdirectory(Auxiliary) add_subdirectory(Auxiliary)
endif()

View File

@ -18,8 +18,3 @@ set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake")
set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_DROP_SITE_CDASH TRUE)
set(CTEST_CDASH_VERSION "1.6") set(CTEST_CDASH_VERSION "1.6")
set(CTEST_CDASH_QUERY_VERSION TRUE) set(CTEST_CDASH_QUERY_VERSION TRUE)
# use old trigger stuff so that cmake 2.4 and below will not
# get errors on trigger
set (TRIGGER_SITE
"http://public.kitware.com/cgi-bin/Submit-CMake-TestingResults.cgi")

View File

@ -39,6 +39,8 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*"
"Warning: public.*_archive.*clashes with prior module.*" "Warning: public.*_archive.*clashes with prior module.*"
"Warning: LINN32: Last line.*is less.*" "Warning: LINN32: Last line.*is less.*"
"Warning: Olimit was exceeded on function.*"
"Warning: To override Olimit for all functions in file.*"
"warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*" "warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*"
"stl_deque.h:1051" "stl_deque.h:1051"
"(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)"
@ -52,6 +54,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"ld: warning: directory not found for option .-(F|L)" "ld: warning: directory not found for option .-(F|L)"
"warning.*This version of Mac OS X is unsupported" "warning.*This version of Mac OS X is unsupported"
"clang.*: warning: argument unused during compilation: .-g" "clang.*: warning: argument unused during compilation: .-g"
"note: in expansion of macro" # diagnostic context note
# Ignore clang's summary warning, assuming prior text has matched some # Ignore clang's summary warning, assuming prior text has matched some
# other warning expression: # other warning expression:

View File

@ -1,3 +0,0 @@
# This file is provided for compatibility with CMake 2.2 and lower.
# Just include the custom file by its new name.
INCLUDE("CTestCustom.cmake")

View File

@ -156,3 +156,7 @@ target is built before any target using this custom command.
Additionally, if the target is an executable or library a file-level Additionally, if the target is an executable or library a file-level
dependency is created to cause the custom command to re-run whenever dependency is created to cause the custom command to re-run whenever
the target is recompiled. the target is recompiled.
Arguments to ``DEPENDS`` may use "generator expressions" with the syntax
``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for
available expressions.

View File

@ -55,7 +55,7 @@ used in a comparison with the iterator returned by ``end()``:
.. code-block:: c++ .. code-block:: c++
const std::set<cmStdString>& someSet = getSet(); const std::set<std::string>& someSet = getSet();
if (someSet.find("needle") == someSet.end()) // Wrong if (someSet.find("needle") == someSet.end()) // Wrong
{ {
// ... // ...
@ -66,8 +66,8 @@ The return value of ``find()`` must be assigned to an intermediate
.. code-block:: c++ .. code-block:: c++
const std::set<cmStdString>& someSet; const std::set<std::string>& someSet;
const std::set<cmStdString>::const_iterator i = someSet.find("needle"); const std::set<std::string>::const_iterator i = someSet.find("needle");
if (i != propSet.end()) // Ok if (i != propSet.end()) // Ok
{ {
// ... // ...
@ -110,7 +110,7 @@ conversion is not allowed:
.. code-block:: c++ .. code-block:: c++
std::set<cmStdString> theSet; std::set<const char*> theSet;
std::vector<std::string> theVector; std::vector<std::string> theVector;
theVector.insert(theVector.end(), theSet.begin(), theSet.end()); // Wrong theVector.insert(theVector.end(), theSet.begin(), theSet.end()); // Wrong
@ -118,9 +118,9 @@ A loop must be used instead:
.. code-block:: c++ .. code-block:: c++
std::set<cmStdString> theSet; std::set<const char*> theSet;
std::vector<std::string> theVector; std::vector<std::string> theVector;
for(std::set<cmStdString>::iterator li = theSet.begin(); for(std::set<const char*>::iterator li = theSet.begin();
li != theSet.end(); ++li) li != theSet.end(); ++li)
{ {
theVector.push_back(*li); theVector.push_back(*li);

View File

@ -138,6 +138,7 @@ All Modules
/module/FindMPEG /module/FindMPEG
/module/FindMPI /module/FindMPI
/module/FindOpenAL /module/FindOpenAL
/module/FindOpenCL
/module/FindOpenGL /module/FindOpenGL
/module/FindOpenMP /module/FindOpenMP
/module/FindOpenSceneGraph /module/FindOpenSceneGraph

View File

@ -100,6 +100,10 @@ Properties on Targets
/prop_tgt/COMPILE_DEFINITIONS /prop_tgt/COMPILE_DEFINITIONS
/prop_tgt/COMPILE_FLAGS /prop_tgt/COMPILE_FLAGS
/prop_tgt/COMPILE_OPTIONS /prop_tgt/COMPILE_OPTIONS
/prop_tgt/COMPILE_PDB_NAME
/prop_tgt/COMPILE_PDB_NAME_CONFIG
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/CONFIG_OUTPUT_NAME /prop_tgt/CONFIG_OUTPUT_NAME
/prop_tgt/CONFIG_POSTFIX /prop_tgt/CONFIG_POSTFIX
/prop_tgt/DEBUG_POSTFIX /prop_tgt/DEBUG_POSTFIX

View File

@ -201,6 +201,8 @@ Variables that Control the Build
/variable/CMAKE_AUTOUIC /variable/CMAKE_AUTOUIC
/variable/CMAKE_AUTOUIC_OPTIONS /variable/CMAKE_AUTOUIC_OPTIONS
/variable/CMAKE_BUILD_WITH_INSTALL_RPATH /variable/CMAKE_BUILD_WITH_INSTALL_RPATH
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
/variable/CMAKE_CONFIG_POSTFIX /variable/CMAKE_CONFIG_POSTFIX
/variable/CMAKE_DEBUG_POSTFIX /variable/CMAKE_DEBUG_POSTFIX
/variable/CMAKE_EXE_LINKER_FLAGS_CONFIG /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG

View File

@ -0,0 +1 @@
.. cmake-module:: ../../Modules/FindOpenCL.cmake

View File

@ -0,0 +1,11 @@
COMPILE_PDB_NAME
----------------
Output name for the MS debug symbol ``.pdb`` file generated by the
compiler while building source files.
This property specifies the base name for the debug symbols file.
If not set, the default is unspecified.
.. |PDB_XXX| replace:: :prop_tgt:`PDB_NAME`
.. include:: COMPILE_PDB_NOTE.txt

View File

@ -0,0 +1,10 @@
COMPILE_PDB_NAME_<CONFIG>
-------------------------
Per-configuration output name for the MS debug symbol ``.pdb`` file
generated by the compiler while building source files.
This is the configuration-specific version of :prop_tgt:`COMPILE_PDB_NAME`.
.. |PDB_XXX| replace:: :prop_tgt:`PDB_NAME_<CONFIG>`
.. include:: COMPILE_PDB_NOTE.txt

View File

@ -0,0 +1,8 @@
.. note::
The compiler-generated program database files are specified by the
``/Fd`` compiler flag and are not the same as linker-generated
program database files specified by the ``/pdb`` linker flag.
Use the |PDB_XXX| property to specify the latter.
This property is not implemented by the :generator:`Visual Studio 6`
generator.

View File

@ -0,0 +1,13 @@
COMPILE_PDB_OUTPUT_DIRECTORY
----------------------------
Output directory for the MS debug symbol ``.pdb`` file
generated by the compiler while building source files.
This property specifies the directory into which the MS debug symbols
will be placed by the compiler. This property is initialized by the
value of the :variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY` variable
if it is set when a target is created.
.. |PDB_XXX| replace:: :prop_tgt:`PDB_OUTPUT_DIRECTORY`
.. include:: COMPILE_PDB_NOTE.txt

View File

@ -0,0 +1,16 @@
COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
-------------------------------------
Per-configuration output directory for the MS debug symbol ``.pdb`` file
generated by the compiler while building source files.
This is a per-configuration version of
:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`,
but multi-configuration generators (VS, Xcode) do NOT append a
per-configuration subdirectory to the specified directory. This
property is initialized by the value of the
:variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>` variable
if it is set when a target is created.
.. |PDB_XXX| replace:: :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`
.. include:: COMPILE_PDB_NOTE.txt

View File

@ -7,7 +7,5 @@ linker for an executable or shared library target.
This property specifies the base name for the debug symbols file. This property specifies the base name for the debug symbols file.
If not set, the logical target name is used by default. If not set, the logical target name is used by default.
.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME`
.. include:: PDB_NOTE.txt .. include:: PDB_NOTE.txt
This property is not implemented by the :generator:`Visual Studio 6`
generator.

View File

@ -6,5 +6,5 @@ generated by the linker for an executable or shared library target.
This is the configuration-specific version of :prop_tgt:`PDB_NAME`. This is the configuration-specific version of :prop_tgt:`PDB_NAME`.
This property is not implemented by the :generator:`Visual Studio 6` .. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME_<CONFIG>`
generator. .. include:: PDB_NOTE.txt

View File

@ -3,6 +3,10 @@
is invoked to produce them so they have no linker-generated ``.pdb`` file is invoked to produce them so they have no linker-generated ``.pdb`` file
containing debug symbols. containing debug symbols.
The compiler-generated program database files specified by the MSVC The linker-generated program database files are specified by the
``/Fd`` flag are not the same as linker-generated program database ``/pdb`` linker flag and are not the same as compiler-generated
files and so are not influenced by this property. program database files specified by the ``/Fd`` compiler flag.
Use the |COMPILE_PDB_XXX| property to specify the latter.
This property is not implemented by the :generator:`Visual Studio 6`
generator.

View File

@ -9,7 +9,5 @@ will be placed by the linker. This property is initialized by the
value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY` variable if it is value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY` variable if it is
set when a target is created. set when a target is created.
.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`
.. include:: PDB_NOTE.txt .. include:: PDB_NOTE.txt
This property is not implemented by the :generator:`Visual Studio 6`
generator.

View File

@ -11,5 +11,5 @@ property is initialized by the value of the
:variable:`CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG>` variable if it is :variable:`CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG>` variable if it is
set when a target is created. set when a target is created.
This property is not implemented by the :generator:`Visual Studio 6` .. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>`
generator. .. include:: PDB_NOTE.txt

View File

@ -0,0 +1,7 @@
0-sample-topic
--------------
* This is a sample release note for the change in a topic.
Developers should add similar notes for each topic branch
making a noteworthy change. Each document should be named
and titled to match the topic name to avoid merge conflicts.

View File

@ -0,0 +1,6 @@
ExternalProject-BUILD_ALWAYS
----------------------------
* The :module:`ExternalProject` module ``ExternalProject_Add`` command
learned a new ``BUILD_ALWAYS`` option to cause the external project
build step to run every time the host project is built.

View File

@ -0,0 +1,6 @@
ExternalProject-no-download-progress
------------------------------------
* The :module:`ExternalProject` module ``ExternalProject_Add`` command
learned a new ``DOWNLOAD_NO_PROGRESS`` option to disable progress
output while downloading the source tarball.

View File

@ -0,0 +1,6 @@
FeatureSummary_combine_WHAT_values
----------------------------------
* The :module:`FeatureSummary` module ``feature_summary`` API
learned to accept multiple values for the ``WHAT`` option and
combine them appropriately.

View File

@ -0,0 +1,7 @@
FindGTest-AUTO-SOURCES
----------------------
* The :module:`FindGTest` module ``gtest_add_tests`` macro learned
a new ``AUTO`` option to automatically read the :prop_tgt:`SOURCES`
target property of the test executable and scan the source files
for tests to be added.

View File

@ -0,0 +1,5 @@
FindHg-WC_INFO
--------------
* The :module:`FindHg` module gained a new ``Hg_WC_INFO`` macro to
help run ``hg`` to extract information about a Mercurial work copy.

View File

@ -0,0 +1,5 @@
FindPkgConfig-PKG_CONFIG
------------------------
* The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG``
environment variable value as the ``pkg-config`` executable, if set.

View File

@ -0,0 +1,4 @@
add-FindOpenCL
--------------
* The :module:`FindOpenCL` module was introduced.

View File

@ -0,0 +1,5 @@
add_custom_command-DEPENDS-genex
--------------------------------
* The :command:`add_custom_command` command learned to interpret
:manual:`cmake-generator-expressions(7)` in arguments to ``DEPENDS``.

View File

@ -0,0 +1,6 @@
cpack-deb-compression-types
---------------------------
* The :module:`CPackDeb` module learned a new
:variable:`CPACK_DEBIAN_COMPRESSION_TYPE` variable to set the
tarball compression type.

View File

@ -0,0 +1,5 @@
ctest-coverage-extra
--------------------
* The :command:`ctest_coverage` command learned to read variable
``CTEST_COVERAGE_EXTRA_FLAGS`` to set ``CoverageExtraFlags``.

View File

@ -0,0 +1,5 @@
ctest-intel-coverage
--------------------
* The :command:`ctest_coverage` command learned to support
Intel coverage files with the ``codecov`` tool.

View File

@ -0,0 +1,5 @@
custom-ninja-deptypes
---------------------
* Add a `CMAKE_NINJA_DEPTYPE_<LANG>` variable so that compilers may set the
deptype for use in Ninja other than those CMake itself knows about.

View File

@ -0,0 +1,6 @@
faster-parsers
--------------
* The :manual:`cmake-language(7)` internal implementation of generator
expression and list expansion parsers have been optimized and shows
non-trivial speedup on large projects.

View File

@ -0,0 +1,5 @@
link-libraries-response-files
-----------------------------
* The Makefile generators learned to use response files with GNU tools
on Windows to pass library directories and names to the linker.

View File

@ -0,0 +1,10 @@
msvc-compiler-pdb-files
-----------------------
* New :prop_tgt:`COMPILE_PDB_NAME` and
:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` target properties
were introduced to specify the MSVC compiler program database
file location (``cl /Fd``). This complements the existing
:prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
target properties that specify the linker program database
file location (``link /pdb``).

View File

@ -5,6 +5,8 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file This file should include the adjacent "dev.txt" file
in development versions but not in release versions. in development versions but not in release versions.
.. include:: dev.txt
Releases Releases
======== ========

View File

@ -0,0 +1,8 @@
CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
----------------------------------
Output directory for MS debug symbol ``.pdb`` files
generated by the compiler while building source files.
This variable is used to initialize the
:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` property on all the targets.

View File

@ -0,0 +1,11 @@
CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
-------------------------------------------
Per-configuration output directory for MS debug symbol ``.pdb`` files
generated by the compiler while building source files.
This is a per-configuration version of
:variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY`.
This variable is used to initialize the
:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>`
property on all the targets.

View File

@ -1,7 +1,10 @@
CMAKE_HOST_SYSTEM CMAKE_HOST_SYSTEM
----------------- -----------------
Name of system cmake is being run on. Composit Name of OS CMake is being run on.
The same as CMAKE_SYSTEM but for the host system instead of the target This variable is the composite of :variable:`CMAKE_HOST_SYSTEM_NAME` and
system when cross compiling. :variable:`CMAKE_HOST_SYSTEM_VERSION`, e.g.
``${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_VERSION}``. If
:variable:`CMAKE_HOST_SYSTEM_VERSION` is not set, then this variable is
the same as :variable:`CMAKE_HOST_SYSTEM_NAME`.

View File

@ -3,5 +3,6 @@ CMAKE_HOST_SYSTEM_NAME
Name of the OS CMake is running on. Name of the OS CMake is running on.
The same as CMAKE_SYSTEM_NAME but for the host system instead of the On systems that have the uname command, this variable is set to the
target system when cross compiling. output of uname -s. ``Linux``, ``Windows``, and ``Darwin`` for Mac OS X
are the values found on the big three operating systems.

View File

@ -3,5 +3,6 @@ CMAKE_HOST_SYSTEM_PROCESSOR
The name of the CPU CMake is running on. The name of the CPU CMake is running on.
The same as CMAKE_SYSTEM_PROCESSOR but for the host system instead of On systems that support uname, this variable is set to the output of
the target system when cross compiling. uname -p, on windows it is set to the value of the environment variable
``PROCESSOR_ARCHITECTURE``.

View File

@ -1,7 +1,8 @@
CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_SYSTEM_VERSION
------------------------- -------------------------
OS version CMake is running on. The OS version CMake is running on.
The same as CMAKE_SYSTEM_VERSION but for the host system instead of A numeric version string for the system. On systems that support
the target system when cross compiling. uname, this variable is set to the output of uname -r. On other
systems this is set to major-minor version numbers.

View File

@ -1,9 +1,10 @@
CMAKE_SYSTEM CMAKE_SYSTEM
------------ ------------
Name of system cmake is compiling for. Composit Name of OS CMake is compiling for.
This variable is the composite of CMAKE_SYSTEM_NAME and This variable is the composite of :variable:`CMAKE_SYSTEM_NAME` and
CMAKE_SYSTEM_VERSION, like this :variable:`CMAKE_SYSTEM_VERSION`, e.g.
${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}. If CMAKE_SYSTEM_VERSION ``${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}``. If
is not set, then CMAKE_SYSTEM is the same as CMAKE_SYSTEM_NAME. :variable:`CMAKE_SYSTEM_VERSION` is not set, then this variable is
the same as :variable:`CMAKE_SYSTEM_NAME`.

View File

@ -3,7 +3,6 @@ CMAKE_SYSTEM_NAME
Name of the OS CMake is building for. Name of the OS CMake is building for.
This is the name of the operating system on which CMake is targeting. This is the name of the OS on which CMake is targeting. This variable
On systems that have the uname command, this variable is set to the is the same as :variable:`CMAKE_HOST_SYSTEM_NAME` if you build for the
output of uname -s. Linux, Windows, and Darwin for Mac OS X are the host system instead of the target system when cross compiling.
values found on the big three operating systems.

View File

@ -3,6 +3,6 @@ CMAKE_SYSTEM_PROCESSOR
The name of the CPU CMake is building for. The name of the CPU CMake is building for.
On systems that support uname, this variable is set to the output of This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if
uname -p, on windows it is set to the value of the environment you build for the host system instead of the target system when
variable PROCESSOR_ARCHITECTURE cross compiling.

View File

@ -1,8 +1,8 @@
CMAKE_SYSTEM_VERSION CMAKE_SYSTEM_VERSION
-------------------- --------------------
OS version CMake is building for. The OS version CMake is building for.
A numeric version string for the system, on systems that support This variable is the same as :variable:`CMAKE_HOST_SYSTEM_VERSION` if
uname, this variable is set to the output of uname -r. On other you build for the host system instead of the target system when
systems this is set to major-minor version numbers. cross compiling.

View File

@ -26,7 +26,7 @@ if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1) set(MINGW 1)
endif() endif()
set(CMAKE_C_COMPILER_ID_RUN 1) set(CMAKE_C_COMPILER_ID_RUN 1)
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c) set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_C_LINKER_PREFERENCE 10) set(CMAKE_C_LINKER_PREFERENCE 10)

View File

@ -68,10 +68,19 @@
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
# define COMPILER_ID "Watcom" # if __WATCOMC__ < 1200
/* __WATCOMC__ = VVRR */ # define COMPILER_ID "Watcom"
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) /* __WATCOMC__ = VVRP */
# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# else
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# endif
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_C) #elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro" # define COMPILER_ID "SunPro"

View File

@ -27,7 +27,7 @@ if(CMAKE_COMPILER_IS_MINGW)
endif() endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1) set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
set(CMAKE_CXX_LINKER_PREFERENCE 30) set(CMAKE_CXX_LINKER_PREFERENCE 30)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)

View File

@ -73,10 +73,19 @@
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
# define COMPILER_ID "Watcom" # if __WATCOMC__ < 1200
/* __WATCOMC__ = VVRR */ # define COMPILER_ID "Watcom"
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) /* __WATCOMC__ = VVRP */
# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) # define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# else
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# endif
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_CC) #elif defined(__SUNPRO_CC)
# define COMPILER_ID "SunPro" # define COMPILER_ID "SunPro"

View File

@ -16,9 +16,11 @@
# cache values that can be initialized in the platform-compiler.cmake file # cache values that can be initialized in the platform-compiler.cmake file
# it may be included by more than one language. # it may be included by more than one language.
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" if(NOT "x$ENV{LDFLAGS}" STREQUAL "x")
CACHE STRING "Flags used by the linker.") set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
set (CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
set (CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
endif()
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none # default build type is none
@ -82,12 +84,17 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
"Flags used by the linker during Release with Debug Info builds.") "Flags used by the linker during Release with Debug Info builds.")
endif() endif()
# executable linker flags
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker.")
# shared linker flags # shared linker flags
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of dll's.") CACHE STRING "Flags used by the linker during the creation of dll's.")
# module linker flags # module linker flags
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of modules.") CACHE STRING "Flags used by the linker during the creation of modules.")
# static linker flags # static linker flags
@ -124,4 +131,3 @@ CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
CMAKE_STATIC_LINKER_FLAGS_RELEASE CMAKE_STATIC_LINKER_FLAGS_RELEASE
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
) )

View File

@ -74,6 +74,23 @@
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix" # define PLATFORM_ID "Xenix"
#elif defined(__WATCOMC__)
# if defined(__LINUX__)
# define PLATFORM_ID "Linux"
# elif defined(__DOS__)
# define PLATFORM_ID "DOS"
# elif defined(__OS2__)
# define PLATFORM_ID "OS2"
# elif defined(__WINDOWS__)
# define PLATFORM_ID "Windows3x"
# else /* unknown platform */
# define PLATFORM_ID ""
# endif
#else /* unknown platform */ #else /* unknown platform */
# define PLATFORM_ID "" # define PLATFORM_ID ""
@ -107,6 +124,17 @@
# define ARCHITECTURE_ID "" # define ARCHITECTURE_ID ""
# endif # endif
#elif defined(__WATCOMC__)
# if defined(_M_I86)
# define ARCHITECTURE_ID "I86"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#else #else
# define ARCHITECTURE_ID "" # define ARCHITECTURE_ID ""
#endif #endif

View File

@ -67,7 +67,12 @@
# * Mandatory : YES # * Mandatory : YES
# * Default : 'devel' # * Default : 'devel'
# #
# The debian package section # .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
#
# * Mandatory : YES
# * Default : 'gzip'
#
# Possible values are: lzma, xz, bzip2 and gzip.
# #
# .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
# #
@ -390,6 +395,12 @@ if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
endif() endif()
# Compression: (recommended)
if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
endif()
# Recommends: # Recommends:
# You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS

View File

@ -216,9 +216,24 @@
# allow other CMake projects to find your package with # allow other CMake projects to find your package with
# the :command:`find_package` command. # the :command:`find_package` command.
# #
# .. variable:: CPACK_WIX_PROPERTY_<PROPERTY>
#
# This variable can be used to provide a value for
# the Windows Installer property ``<PROPERTY>``
#
# The follwing list contains some example properties that can be used to
# customize information under
# "Programs and Features" (also known as "Add or Remove Programs")
#
# * ARPCOMMENTS - Comments
# * ARPHELPLINK - Help and support information URL
# * ARPURLINFOABOUT - General information URL
# * URLUPDATEINFO - Update information URL
# * ARPHELPTELEPHONE - Help and support telephone number
# * ARPSIZE - Size (in kilobytes) of the application
#============================================================================= #=============================================================================
# Copyright 2013 Kitware, Inc. # Copyright 2014 Kitware, Inc.
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.

View File

@ -75,6 +75,7 @@
# License text for the above reference.) # License text for the above reference.)
include(CheckIncludeFile) include(CheckIncludeFile)
include(CheckIncludeFileCXX)
cmake_policy(PUSH) cmake_policy(PUSH)
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
@ -218,9 +219,15 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
set(_builtin 0) set(_builtin 0)
else() else()
set(_builtin 1) set(_builtin 1)
check_include_file(sys/types.h HAVE_SYS_TYPES_H) if("${_language}" STREQUAL "C")
check_include_file(stdint.h HAVE_STDINT_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(stddef.h HAVE_STDDEF_H) check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
elseif("${_language}" STREQUAL "CXX")
check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
check_include_file_cxx(stdint.h HAVE_STDINT_H)
check_include_file_cxx(stddef.h HAVE_STDDEF_H)
endif()
endif() endif()
unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY) unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
unset(_CHECK_TYPE_SIZE_LANGUAGE) unset(_CHECK_TYPE_SIZE_LANGUAGE)

View File

@ -20,6 +20,7 @@
# [DOWNLOAD_NAME fname] # File name to store (if not end of URL) # [DOWNLOAD_NAME fname] # File name to store (if not end of URL)
# [DOWNLOAD_DIR dir] # Directory to store downloaded files # [DOWNLOAD_DIR dir] # Directory to store downloaded files
# [DOWNLOAD_COMMAND cmd...] # Command to download source tree # [DOWNLOAD_COMMAND cmd...] # Command to download source tree
# [DOWNLOAD_NO_PROGRESS 1] # Disable download progress reports
# [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository # [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository
# [CVS_MODULE mod] # Module to checkout from CVS repo # [CVS_MODULE mod] # Module to checkout from CVS repo
# [CVS_TAG tag] # Tag to checkout from CVS repo # [CVS_TAG tag] # Tag to checkout from CVS repo
@ -54,6 +55,7 @@
# [BINARY_DIR dir] # Specify build dir location # [BINARY_DIR dir] # Specify build dir location
# [BUILD_COMMAND cmd...] # Command to drive the native build # [BUILD_COMMAND cmd...] # Command to drive the native build
# [BUILD_IN_SOURCE 1] # Use source dir for build dir # [BUILD_IN_SOURCE 1] # Use source dir for build dir
# [BUILD_ALWAYS 1] # No stamp file, build step always runs
# #--Install step--------------- # #--Install step---------------
# [INSTALL_DIR dir] # Installation prefix # [INSTALL_DIR dir] # Installation prefix
# [INSTALL_COMMAND cmd...] # Command to drive install after build # [INSTALL_COMMAND cmd...] # Command to drive install after build
@ -514,7 +516,7 @@ endif()
endfunction(_ep_write_gitupdate_script) endfunction(_ep_write_gitupdate_script)
function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo) function(_ep_write_downloadfile_script script_filename remote local timeout no_progress hash tls_verify tls_cainfo)
if(timeout) if(timeout)
set(timeout_args TIMEOUT ${timeout}) set(timeout_args TIMEOUT ${timeout})
set(timeout_msg "${timeout} seconds") set(timeout_msg "${timeout} seconds")
@ -523,6 +525,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash
set(timeout_msg "none") set(timeout_msg "none")
endif() endif()
if(no_progress)
set(show_progress "")
else()
set(show_progress "SHOW_PROGRESS")
endif()
if("${hash}" MATCHES "${_ep_hash_regex}") if("${hash}" MATCHES "${_ep_hash_regex}")
set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}) set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2})
else() else()
@ -562,7 +570,7 @@ ${tls_cainfo}
file(DOWNLOAD file(DOWNLOAD
\"${remote}\" \"${remote}\"
\"${local}\" \"${local}\"
SHOW_PROGRESS ${show_progress}
${hash_args} ${hash_args}
${timeout_args} ${timeout_args}
STATUS status STATUS status
@ -1442,10 +1450,11 @@ function(_ep_add_download_command name)
string(REPLACE ";" "-" fname "${fname}") string(REPLACE ";" "-" fname "${fname}")
set(file ${download_dir}/${fname}) set(file ${download_dir}/${fname})
get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT)
get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS)
get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
set(download_script "${stamp_dir}/download-${name}.cmake") set(download_script "${stamp_dir}/download-${name}.cmake")
_ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}") _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}")
set(cmd ${CMAKE_COMMAND} -P "${download_script}" set(cmd ${CMAKE_COMMAND} -P "${download_script}"
COMMAND) COMMAND)
set(retries 3) set(retries 3)
@ -1716,10 +1725,18 @@ function(_ep_add_build_command name)
set(log "") set(log "")
endif() endif()
get_property(build_always TARGET ${name} PROPERTY _EP_BUILD_ALWAYS)
if(build_always)
set(always 1)
else()
set(always 0)
endif()
ExternalProject_Add_Step(${name} build ExternalProject_Add_Step(${name} build
COMMAND ${cmd} COMMAND ${cmd}
WORKING_DIRECTORY ${binary_dir} WORKING_DIRECTORY ${binary_dir}
DEPENDEES configure DEPENDEES configure
ALWAYS ${always}
${log} ${log}
) )
endfunction() endfunction()

View File

@ -71,6 +71,13 @@
# RUNTIME_PACKAGES_FOUND: only those packages which have been found which have the type RUNTIME # RUNTIME_PACKAGES_FOUND: only those packages which have been found which have the type RUNTIME
# RUNTIME_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RUNTIME # RUNTIME_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RUNTIME
# #
# With the exception of the ``ALL`` value, these values can be combined
# in order to customize the output. For example:
#
# ::
#
# feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
#
# #
# #
# If a FILENAME is given, the information is printed into this file. If # If a FILENAME is given, the information is printed into this file. If
@ -417,8 +424,8 @@ endfunction()
function(FEATURE_SUMMARY) function(FEATURE_SUMMARY)
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) # CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
set(oneValueArgs FILENAME VAR DESCRIPTION WHAT) set(oneValueArgs FILENAME VAR DESCRIPTION)
set(multiValueArgs ) # none set(multiValueArgs WHAT)
CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
@ -451,23 +458,42 @@ function(FEATURE_SUMMARY)
set(requiredPackagesNotFound TRUE) set(requiredPackagesNotFound TRUE)
endif() endif()
elseif("${_FS_WHAT}" STREQUAL "ALL") else()
if("${_FS_WHAT}" STREQUAL "ALL")
set(allWhatParts "ENABLED_FEATURES" set(allWhatParts "ENABLED_FEATURES"
"RUNTIME_PACKAGES_FOUND" "RUNTIME_PACKAGES_FOUND"
"OPTIONAL_PACKAGES_FOUND" "OPTIONAL_PACKAGES_FOUND"
"RECOMMENDED_PACKAGES_FOUND" "RECOMMENDED_PACKAGES_FOUND"
"REQUIRED_PACKAGES_FOUND" "REQUIRED_PACKAGES_FOUND"
"DISABLED_FEATURES" "DISABLED_FEATURES"
"RUNTIME_PACKAGES_NOT_FOUND" "RUNTIME_PACKAGES_NOT_FOUND"
"OPTIONAL_PACKAGES_NOT_FOUND" "OPTIONAL_PACKAGES_NOT_FOUND"
"RECOMMENDED_PACKAGES_NOT_FOUND" "RECOMMENDED_PACKAGES_NOT_FOUND"
"REQUIRED_PACKAGES_NOT_FOUND" "REQUIRED_PACKAGES_NOT_FOUND"
) )
else()
set(allWhatParts)
foreach(part ${_FS_WHAT})
list(FIND validWhatParts "${part}" indexInList)
if(NOT "${indexInList}" STREQUAL "-1")
list(APPEND allWhatParts "${part}")
else()
if("${part}" STREQUAL "ALL")
message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ALL, which cannot be combined with other values.")
else()
message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ${part}, which is not a valid value.")
endif()
endif()
endforeach()
endif()
set(title_ENABLED_FEATURES "The following features have been enabled:") set(title_ENABLED_FEATURES "The following features have been enabled:")
set(title_DISABLED_FEATURES "The following features have been disabled:") set(title_DISABLED_FEATURES "The following features have been disabled:")
set(title_PACKAGES_FOUND "The following packages have been found:")
set(title_PACKAGES_NOT_FOUND "The following packages have not been found:")
set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:") set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:")
set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:") set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:")
set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:") set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:")
@ -488,8 +514,6 @@ function(FEATURE_SUMMARY)
endif() endif()
endif() endif()
endforeach() endforeach()
else()
message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.")
endif() endif()
if(_FS_FILENAME) if(_FS_FILENAME)

View File

@ -954,7 +954,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
# Compute component-specific hints. # Compute component-specific hints.
set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python") if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
${COMPONENT} STREQUAL "graph_parallel")
foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
if(IS_ABSOLUTE "${lib}") if(IS_ABSOLUTE "${lib}")
get_filename_component(libdir "${lib}" PATH) get_filename_component(libdir "${lib}" PATH)

View File

@ -987,7 +987,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path)
endif() endif()
endif() endif()
# This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the # This recipe is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
# CMake source. # CMake source.
# Remove leading / # Remove leading /

View File

@ -62,7 +62,7 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
ENV GTKMM_BASEPATH ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES include/freetype2 include PATH_SUFFIXES include/freetype2 include freetype2
) )
find_path(FREETYPE_INCLUDE_DIR_freetype2 find_path(FREETYPE_INCLUDE_DIR_freetype2
@ -79,7 +79,7 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2
ENV GTKMM_BASEPATH ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
PATH_SUFFIXES include/freetype2 include PATH_SUFFIXES include/freetype2 include freetype2
) )
find_library(FREETYPE_LIBRARY find_library(FREETYPE_LIBRARY

View File

@ -79,7 +79,7 @@
# extra_args = Pass a list of extra arguments to be passed to # extra_args = Pass a list of extra arguments to be passed to
# executable enclosed in quotes (or "" for none) # executable enclosed in quotes (or "" for none)
# ARGN = A list of source files to search for tests & test # ARGN = A list of source files to search for tests & test
# fixtures. # fixtures. Or AUTO to find them from executable target.
# #
# #
# #
@ -88,7 +88,7 @@
# Example: # Example:
# set(FooTestArgs --foo 1 --bar 2) # set(FooTestArgs --foo 1 --bar 2)
# add_executable(FooTest FooUnitTest.cc) # add_executable(FooTest FooUnitTest.cc)
# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc) # GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO)
#============================================================================= #=============================================================================
# Copyright 2009 Kitware, Inc. # Copyright 2009 Kitware, Inc.
@ -111,6 +111,10 @@ function(GTEST_ADD_TESTS executable extra_args)
if(NOT ARGN) if(NOT ARGN)
message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS") message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
endif() endif()
if(ARGN STREQUAL "AUTO")
# obtain sources used for building that executable
get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
endif()
foreach(source ${ARGN}) foreach(source ${ARGN})
file(READ "${source}" contents) file(READ "${source}" contents)
string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})

View File

@ -2,7 +2,7 @@
# FindHg # FindHg
# ------ # ------
# #
# # Extract information from a mercurial working copy.
# #
# The module defines the following variables: # The module defines the following variables:
# #
@ -12,6 +12,20 @@
# HG_FOUND - true if the command line client was found # HG_FOUND - true if the command line client was found
# HG_VERSION_STRING - the version of mercurial found # HG_VERSION_STRING - the version of mercurial found
# #
# If the command line client executable is found the following macro is defined:
#
# ::
#
# HG_WC_INFO(<dir> <var-prefix>)
#
# Hg_WC_INFO extracts information of a mercurial working copy
# at a given location. This macro defines the following variables:
#
# ::
#
# <var-prefix>_WC_CHANGESET - current changeset
# <var-prefix>_WC_REVISION - current revision
#
# Example usage: # Example usage:
# #
# :: # ::
@ -19,11 +33,15 @@
# find_package(Hg) # find_package(Hg)
# if(HG_FOUND) # if(HG_FOUND)
# message("hg found: ${HG_EXECUTABLE}") # message("hg found: ${HG_EXECUTABLE}")
# HG_WC_INFO(${PROJECT_SOURCE_DIR} Project)
# message("Current revision is ${Project_WC_REVISION}")
# message("Current changeset is ${Project_WC_CHANGESET}")
# endif() # endif()
#============================================================================= #=============================================================================
# Copyright 2010-2012 Kitware, Inc. # Copyright 2010-2012 Kitware, Inc.
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de> # Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
# Copyright 2014 Matthaeus G. Chajdas
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -37,6 +55,8 @@
find_program(HG_EXECUTABLE find_program(HG_EXECUTABLE
NAMES hg NAMES hg
PATHS
[HKEY_LOCAL_MACHINE\\Software\\TortoiseHG]
PATH_SUFFIXES Mercurial PATH_SUFFIXES Mercurial
DOC "hg command line client" DOC "hg command line client"
) )
@ -51,6 +71,21 @@ if(HG_EXECUTABLE)
set(HG_VERSION_STRING "${CMAKE_MATCH_1}") set(HG_VERSION_STRING "${CMAKE_MATCH_1}")
endif() endif()
unset(hg_version) unset(hg_version)
macro(HG_WC_INFO dir prefix)
execute_process(COMMAND ${HG_EXECUTABLE} id -i -n
WORKING_DIRECTORY ${dir}
RESULT_VARIABLE hg_id_result
ERROR_VARIABLE hg_id_error
OUTPUT_VARIABLE ${prefix}_WC_DATA
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ${hg_id_result} EQUAL 0)
message(SEND_ERROR "Command \"${HG_EXECUTBALE} id -n\" in directory ${dir} failed with output:\n${hg_id_error}")
endif()
string(REGEX REPLACE "([0-9a-f]+)\\+? [0-9]+\\+?" "\\1" ${prefix}_WC_CHANGESET ${${prefix}_WC_DATA})
string(REGEX REPLACE "[0-9a-f]+\\+? ([0-9]+)\\+?" "\\1" ${prefix}_WC_REVISION ${${prefix}_WC_DATA})
endmacro(HG_WC_INFO)
endif() endif()
# Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if # Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if

134
Modules/FindOpenCL.cmake Normal file
View File

@ -0,0 +1,134 @@
#.rst:
# FindOpenCL
# ----------
#
# Try to find OpenCL
#
# Once done this will define::
#
# OpenCL_FOUND - True if OpenCL was found
# OpenCL_INCLUDE_DIRS - include directories for OpenCL
# OpenCL_LIBRARIES - link against this library to use OpenCL
# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation
#
# The module will also define two cache variables::
#
# OpenCL_INCLUDE_DIR - the OpenCL include directory
# OpenCL_LIBRARY - the path to the OpenCL library
#
#=============================================================================
# Copyright 2014 Matthaeus G. Chajdas
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
function(_FIND_OPENCL_VERSION)
include(CheckSymbolExists)
include(CMakePushCheckState)
CMAKE_PUSH_CHECK_STATE()
foreach(VERSION "2_0" "1_2" "1_1" "1_0")
set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
if(APPLE)
CHECK_SYMBOL_EXISTS(
CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
OPENCL_VERSION_${VERSION})
else()
CHECK_SYMBOL_EXISTS(
CL_VERSION_${VERSION}
"${OpenCL_INCLUDE_DIR}/CL/cl.h"
OPENCL_VERSION_${VERSION})
endif()
if(OPENCL_VERSION_${VERSION})
string(REPLACE "_" "." VERSION "${VERSION}")
set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
list(GET version_components 0 major_version)
list(GET version_components 1 minor_version)
set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
break()
endif()
endforeach()
CMAKE_POP_CHECK_STATE()
endfunction()
find_path(OpenCL_INCLUDE_DIR
NAMES
CL/cl.h OpenCL/cl.h
PATHS ENV
"PROGRAMFILES(X86)"
AMDAPPSDKROOT
INTELOCLSDKROOT
NVSDKCOMPUTE_ROOT
CUDA_PATH
ATISTREAMSDKROOT
PATH_SUFFIXES
OpenCL/common/inc
"AMD APP/include")
_FIND_OPENCL_VERSION()
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library(OpenCL_LIBRARY
NAMES OpenCL
PATHS ENV
"PROGRAMFILES(X86)"
AMDAPPSDKROOT
INTELOCLSDKROOT
CUDA_PATH
NVSDKCOMPUTE_ROOT
ATISTREAMSDKROOT
PATH_SUFFIXES
"AMD APP/lib/x86"
lib/x86
lib/Win32
OpenCL/common/lib/Win32)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(OpenCL_LIBRARY
NAMES OpenCL
PATHS ENV
"PROGRAMFILES(X86)"
AMDAPPSDKROOT
INTELOCLSDKROOT
CUDA_PATH
NVSDKCOMPUTE_ROOT
ATISTREAMSDKROOT
PATH_SUFFIXES
"AMD APP/lib/x86_64"
lib/x86_64
lib/x64
OpenCL/common/lib/x64)
endif()
else()
find_library(OpenCL_LIBRARY
NAMES OpenCL)
endif()
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(
OpenCL
FOUND_VAR OpenCL_FOUND
REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
VERSION_VAR OpenCL_VERSION_STRING)
mark_as_advanced(
OpenCL_INCLUDE_DIR
OpenCL_LIBRARY)

View File

@ -2,140 +2,20 @@
# FindPkgConfig # FindPkgConfig
# ------------- # -------------
# #
# a pkg-config module for CMake # A `pkg-config` module for CMake.
# #
# Finds the ``pkg-config`` executable and add the
# :command:`pkg_check_modules` and :command:`pkg_search_module`
# commands.
# #
# # In order to find the ``pkg-config`` executable, it uses the
# Usage: # :variable:`PKG_CONFIG_EXECUTABLE` variable or the ``PKG_CONFIG``
# # environment variable first.
# ::
#
# pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
# checks for all the given modules
#
#
#
# ::
#
# pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
# checks for given modules and uses the first working one
#
#
#
# When the 'REQUIRED' argument was set, macros will fail with an error
# when module(s) could not be found
#
# When the 'QUIET' argument is set, no status messages will be printed.
#
# It sets the following variables:
#
# ::
#
# PKG_CONFIG_FOUND ... if pkg-config executable was found
# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
# (since CMake 2.8.8)
#
#
#
# For the following variables two sets of values exist; first one is the
# common one and has the given PREFIX. The second set contains flags
# which are given out when pkgconfig was called with the '--static'
# option.
#
# ::
#
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
#
#
# ::
#
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
#
#
#
# There are some special variables whose prefix depends on the count of
# given modules. When there is only one module, <PREFIX> stays
# unchanged. When there are multiple modules, the prefix will be
# changed to <PREFIX>_<MODNAME>:
#
# ::
#
# <XPREFIX>_VERSION ... version of the module
# <XPREFIX>_PREFIX ... prefix-directory of the module
# <XPREFIX>_INCLUDEDIR ... include-dir of the module
# <XPREFIX>_LIBDIR ... lib-dir of the module
#
#
#
# ::
#
# <XPREFIX> = <PREFIX> when |MODULES| == 1, else
# <XPREFIX> = <PREFIX>_<MODNAME>
#
#
#
# A <MODULE> parameter can have the following formats:
#
# ::
#
# {MODNAME} ... matches any version
# {MODNAME}>={VERSION} ... at least version <VERSION> is required
# {MODNAME}={VERSION} ... exactly version <VERSION> is required
# {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
#
#
#
# Examples
#
# ::
#
# pkg_check_modules (GLIB2 glib-2.0)
#
#
#
# ::
#
# pkg_check_modules (GLIB2 glib-2.0>=2.10)
# requires at least version 2.10 of glib2 and defines e.g.
# GLIB2_VERSION=2.10.3
#
#
#
# ::
#
# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
# requires both glib2 and gtk2, and defines e.g.
# FOO_glib-2.0_VERSION=2.10.3
# FOO_gtk+-2.0_VERSION=2.8.20
#
#
#
# ::
#
# pkg_check_modules (XRENDER REQUIRED xrender)
# defines e.g.:
# XRENDER_LIBRARIES=Xrender;X11
# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
#
#
#
# ::
#
# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
#============================================================================= #=============================================================================
# Copyright 2006-2009 Kitware, Inc. # Copyright 2006-2014 Kitware, Inc.
# Copyright 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> # Copyright 2014 Christoph Grüninger <foss@grueninger.de>
# Copyright 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -150,6 +30,10 @@
### Common stuff #### ### Common stuff ####
set(PKG_CONFIG_VERSION 1) set(PKG_CONFIG_VERSION 1)
# find pkg-config, use PKG_CONFIG if set
if((NOT PKG_CONFIG_EXECUTABLE) AND (NOT "$ENV{PKG_CONFIG}" STREQUAL ""))
set(PKG_CONFIG_EXECUTABLE "$ENV{PKG_CONFIG}" CACHE FILEPATH "pkg-config executable")
endif()
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
mark_as_advanced(PKG_CONFIG_EXECUTABLE) mark_as_advanced(PKG_CONFIG_EXECUTABLE)
@ -215,9 +99,20 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
endmacro() endmacro()
# Splits given arguments into options and a package list # Splits given arguments into options and a package list
macro(_pkgconfig_parse_options _result _is_req _is_silent) macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path)
set(${_is_req} 0) set(${_is_req} 0)
set(${_is_silent} 0) set(${_is_silent} 0)
set(${_no_cmake_path} 0)
set(${_no_cmake_environment_path} 0)
if(DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
if(NOT PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
set(${_no_cmake_path} 1)
set(${_no_cmake_environment_path} 1)
endif()
elseif(${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_LESS 3.1)
set(${_no_cmake_path} 1)
set(${_no_cmake_environment_path} 1)
endif()
foreach(_pkg ${ARGN}) foreach(_pkg ${ARGN})
if (_pkg STREQUAL "REQUIRED") if (_pkg STREQUAL "REQUIRED")
@ -226,15 +121,48 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent)
if (_pkg STREQUAL "QUIET") if (_pkg STREQUAL "QUIET")
set(${_is_silent} 1) set(${_is_silent} 1)
endif () endif ()
if (_pkg STREQUAL "NO_CMAKE_PATH")
set(${_no_cmake_path} 1)
endif()
if (_pkg STREQUAL "NO_CMAKE_ENVIRONMENT_PATH")
set(${_no_cmake_environment_path} 1)
endif()
endforeach() endforeach()
set(${_result} ${ARGN}) set(${_result} ${ARGN})
list(REMOVE_ITEM ${_result} "REQUIRED") list(REMOVE_ITEM ${_result} "REQUIRED")
list(REMOVE_ITEM ${_result} "QUIET") list(REMOVE_ITEM ${_result} "QUIET")
list(REMOVE_ITEM ${_result} "NO_CMAKE_PATH")
list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH")
endmacro() endmacro()
# Add the content of a variable or an environment variable to a list of
# paths
# Usage:
# - _pkgconfig_add_extra_path(_extra_paths VAR)
# - _pkgconfig_add_extra_path(_extra_paths ENV VAR)
function(_pkgconfig_add_extra_path _extra_paths_var _var)
set(_is_env 0)
if(_var STREQUAL "ENV")
set(_var ${ARGV2})
set(_is_env 1)
endif()
if(NOT _is_env)
if(NOT "${${_var}}" STREQUAL "")
list(APPEND ${_extra_paths_var} ${CMAKE_PREFIX_PATH})
endif()
else()
if(NOT "$ENV{${_var}}" STREQUAL "")
file(TO_CMAKE_PATH "$ENV{${_var}}" _path)
list(APPEND ${_extra_paths_var} ${_path})
unset(_path)
endif()
endif()
set(${_extra_paths_var} ${${_extra_paths_var}} PARENT_SCOPE)
endfunction()
### ###
macro(_pkg_check_modules_internal _is_required _is_silent _prefix) macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix)
_pkgconfig_unset(${_prefix}_FOUND) _pkgconfig_unset(${_prefix}_FOUND)
_pkgconfig_unset(${_prefix}_VERSION) _pkgconfig_unset(${_prefix}_VERSION)
_pkgconfig_unset(${_prefix}_PREFIX) _pkgconfig_unset(${_prefix}_PREFIX)
@ -273,6 +201,77 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
set(_pkg_check_modules_packages) set(_pkg_check_modules_packages)
set(_pkg_check_modules_failed) set(_pkg_check_modules_failed)
set(_extra_paths)
if(NOT _no_cmake_path)
_pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH)
_pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH)
_pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH)
endif()
if(NOT _no_cmake_environment_path)
_pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH)
_pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH)
_pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
endif()
if(NOT "${_extra_paths}" STREQUAL "")
# Save the PKG_CONFIG_PATH environment variable, and add paths
# from the CMAKE_PREFIX_PATH variables
set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH})
set(_pkgconfig_path ${_pkgconfig_path_old})
if(NOT "${_pkgconfig_path}" STREQUAL "")
file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
endif()
# Create a list of the possible pkgconfig subfolder (depending on
# the system
set(_lib_dirs)
if(NOT DEFINED CMAKE_SYSTEM_NAME
OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
AND NOT CMAKE_CROSSCOMPILING))
if(EXISTS "/etc/debian_version") # is this a debian system ?
if(CMAKE_LIBRARY_ARCHITECTURE)
list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
endif()
else()
# not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if(uselib64)
list(APPEND _lib_dirs "lib64/pkgconfig")
endif()
endif()
endif()
list(APPEND _lib_dirs "lib/pkgconfig")
# Check if directories exist and eventually append them to the
# pkgconfig path list
foreach(_prefix_dir ${_extra_paths})
foreach(_lib_dir ${_lib_dirs})
if(EXISTS "${_prefix_dir}/${_lib_dir}")
list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
list(REMOVE_DUPLICATES _pkgconfig_path)
endif()
endforeach()
endforeach()
# Prepare and set the environment variable
if(NOT "${_pkgconfig_path}" STREQUAL "")
# remove empty values from the list
list(REMOVE_ITEM _pkgconfig_path "")
file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
if(UNIX)
string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}")
endif()
set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
endif()
# Unset variables
unset(_lib_dirs)
unset(_pkgconfig_path)
endif()
# iterate through module list and check whether they exist and match the required version # iterate through module list and check whether they exist and match the required version
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list}) foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
set(_pkg_check_modules_exist_query) set(_pkg_check_modules_exist_query)
@ -338,7 +337,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
if(_pkg_check_modules_failed) if(_pkg_check_modules_failed)
# fail when requested # fail when requested
if (${_is_required}) if (${_is_required})
message(SEND_ERROR "A required package was not found") message(FATAL_ERROR "A required package was not found")
endif () endif ()
else() else()
# when we are here, we checked whether requested modules # when we are here, we checked whether requested modules
@ -376,6 +375,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
endif() endif()
if(NOT "${_extra_paths}" STREQUAL "")
# Restore the environment variable
set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
endif()
unset(_extra_paths)
unset(_pkgconfig_path_old)
else() else()
if (${_is_required}) if (${_is_required})
message(SEND_ERROR "pkg-config tool not found") message(SEND_ERROR "pkg-config tool not found")
@ -387,23 +394,138 @@ endmacro()
### User visible macros start here ### User visible macros start here
### ###
### #[========================================[.rst:
.. command:: pkg_check_modules
Checks for all the given modules. ::
pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
[NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
<MODULE> [<MODULE>]*)
When the ``REQUIRED`` argument was set, macros will fail with an error
when module(s) could not be found.
When the ``QUIET`` argument is set, no status messages will be printed.
By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or
later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set, the
:variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH`, and
:variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables will
be added to ``pkg-config`` search path.
The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments
disable this behavior for the cache variables and the environment
variables, respectively.
It sets the following variables: ::
PKG_CONFIG_FOUND ... if pkg-config executable was found
PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
(since CMake 2.8.8)
For the following variables two sets of values exist; first one is the
common one and has the given PREFIX. The second set contains flags
which are given out when ``pkg-config`` was called with the ``--static``
option. ::
<XPREFIX>_FOUND ... set to 1 if module(s) exist
<XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
<XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
<XPREFIX>_LDFLAGS ... all required linker flags
<XPREFIX>_LDFLAGS_OTHER ... all other linker flags
<XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
<XPREFIX>_CFLAGS ... all required cflags
<XPREFIX>_CFLAGS_OTHER ... the other compiler flags
::
<XPREFIX> = <PREFIX> for common case
<XPREFIX> = <PREFIX>_STATIC for static linking
There are some special variables whose prefix depends on the count of
given modules. When there is only one module, <PREFIX> stays
unchanged. When there are multiple modules, the prefix will be
changed to <PREFIX>_<MODNAME>: ::
<XPREFIX>_VERSION ... version of the module
<XPREFIX>_PREFIX ... prefix-directory of the module
<XPREFIX>_INCLUDEDIR ... include-dir of the module
<XPREFIX>_LIBDIR ... lib-dir of the module
::
<XPREFIX> = <PREFIX> when |MODULES| == 1, else
<XPREFIX> = <PREFIX>_<MODNAME>
A <MODULE> parameter can have the following formats: ::
{MODNAME} ... matches any version
{MODNAME}>={VERSION} ... at least version <VERSION> is required
{MODNAME}={VERSION} ... exactly version <VERSION> is required
{MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
Examples
.. code-block:: cmake
pkg_check_modules (GLIB2 glib-2.0)
.. code-block:: cmake
pkg_check_modules (GLIB2 glib-2.0>=2.10)
Requires at least version 2.10 of glib2 and defines e.g.
``GLIB2_VERSION=2.10.3``
.. code-block:: cmake
pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0)
Requires both glib2 and gtk2, and defines e.g.
``FOO_glib-2.0_VERSION=2.10.3`` and ``FOO_gtk+-2.0_VERSION=2.8.20``
.. code-block:: cmake
pkg_check_modules (XRENDER REQUIRED xrender)
Defines e.g.:
``XRENDER_LIBRARIES=Xrender;X11`` and
``XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp``
#]========================================]
macro(pkg_check_modules _prefix _module0) macro(pkg_check_modules _prefix _module0)
# check cached value # check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
_pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN}) _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
_pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules}) _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif() endif()
endmacro() endmacro()
###
#[========================================[.rst:
.. command:: pkg_search_module
Same as :command:`pkg_check_modules`, but instead it checks for given
modules and uses the first working one. ::
pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
[NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
<MODULE> [<MODULE>]*)
Examples
.. code-block:: cmake
pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
#]========================================]
macro(pkg_search_module _prefix _module0) macro(pkg_search_module _prefix _module0)
# check cached value # check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
set(_pkg_modules_found 0) set(_pkg_modules_found 0)
_pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN}) _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
if (NOT ${_pkg_is_silent}) if (NOT ${_pkg_is_silent})
message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
@ -412,7 +534,7 @@ macro(pkg_search_module _prefix _module0)
# iterate through all modules and stop at the first working one. # iterate through all modules and stop at the first working one.
foreach(_pkg_alt ${_pkg_modules_alt}) foreach(_pkg_alt ${_pkg_modules_alt})
if(NOT _pkg_modules_found) if(NOT _pkg_modules_found)
_pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}") _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" "${_pkg_alt}")
endif() endif()
if (${_prefix}_FOUND) if (${_prefix}_FOUND)
@ -430,6 +552,26 @@ macro(pkg_search_module _prefix _module0)
endif() endif()
endmacro() endmacro()
#[========================================[.rst:
.. variable:: PKG_CONFIG_EXECUTABLE
Path to the pkg-config executable.
.. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH
Whether :command:`pkg_check_modules` and :command:`pkg_search_module`
should add the paths in :variable:`CMAKE_PREFIX_PATH`,
:variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH`
cache and environment variables to ``pkg-config`` search path.
If this variable is not set, this behavior is enabled by default if
:variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or later, disabled
otherwise.
#]========================================]
### Local Variables: ### Local Variables:
### mode: cmake ### mode: cmake
### End: ### End:

View File

@ -27,6 +27,10 @@
# of version numbers that should be taken into account when searching # of version numbers that should be taken into account when searching
# for Python. You need to set this variable before calling # for Python. You need to set this variable before calling
# find_package(PythonInterp). # find_package(PythonInterp).
#
# If also calling find_package(PythonLibs), call find_package(PythonInterp)
# first to get the currently active Python version by default with a consistent
# version of PYTHON_LIBRARIES.
#============================================================================= #=============================================================================
# Copyright 2005-2010 Kitware, Inc. # Copyright 2005-2010 Kitware, Inc.
@ -71,18 +75,23 @@ if(PythonInterp_FIND_VERSION)
else() else()
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
endif() endif()
list(APPEND _Python_NAMES python)
# Search for the current active python version first
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES}) find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
# Set up the versions we know about, in the order we will search. Always add # Set up the versions we know about, in the order we will search. Always add
# the user supplied additional versions to the front. # the user supplied additional versions to the front.
set(_Python_VERSIONS set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
${Python_ADDITIONAL_VERSIONS} # If FindPythonInterp has already found the major and minor version,
${_PYTHON_FIND_OTHER_VERSIONS} # insert that version next to get consistent versions of the interpreter and
) # library.
if(DEFINED PYTHONLIBS_VERSION_STRING)
string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}")
list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR)
list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR)
list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR})
endif()
# Search for the current active python version first
list(APPEND _Python_VERSIONS ";")
list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
unset(_PYTHON_FIND_OTHER_VERSIONS) unset(_PYTHON_FIND_OTHER_VERSIONS)
unset(_PYTHON1_VERSIONS) unset(_PYTHON1_VERSIONS)
@ -91,7 +100,7 @@ unset(_PYTHON3_VERSIONS)
# Search for newest python version if python executable isn't found # Search for newest python version if python executable isn't found
if(NOT PYTHON_EXECUTABLE) if(NOT PYTHON_EXECUTABLE)
foreach(_CURRENT_VERSION ${_Python_VERSIONS}) foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
set(_Python_NAMES python${_CURRENT_VERSION}) set(_Python_NAMES python${_CURRENT_VERSION})
if(WIN32) if(WIN32)
list(APPEND _Python_NAMES python) list(APPEND _Python_NAMES python)

View File

@ -31,6 +31,10 @@
# #
# PYTHON_LIBRARY - path to the python library # PYTHON_LIBRARY - path to the python library
# PYTHON_INCLUDE_DIR - path to where Python.h is found # PYTHON_INCLUDE_DIR - path to where Python.h is found
#
# If also calling find_package(PythonInterp), call find_package(PythonInterp)
# first to get the currently active Python version by default with a consistent
# version of PYTHON_LIBRARIES.
#============================================================================= #=============================================================================
# Copyright 2001-2009 Kitware, Inc. # Copyright 2001-2009 Kitware, Inc.
@ -80,10 +84,14 @@ endif()
# Set up the versions we know about, in the order we will search. Always add # Set up the versions we know about, in the order we will search. Always add
# the user supplied additional versions to the front. # the user supplied additional versions to the front.
set(_Python_VERSIONS # If FindPythonInterp has already found the major and minor version,
${Python_ADDITIONAL_VERSIONS} # insert that version between the user supplied versions and the stock
${_PYTHON_FIND_OTHER_VERSIONS} # version list.
) set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR)
list(APPEND _Python_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
endif()
list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
unset(_PYTHON_FIND_OTHER_VERSIONS) unset(_PYTHON_FIND_OTHER_VERSIONS)
unset(_PYTHON1_VERSIONS) unset(_PYTHON1_VERSIONS)

View File

@ -54,7 +54,9 @@ find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
HINTS HINTS
ENV SDLIMAGEDIR ENV SDLIMAGEDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include PATH_SUFFIXES SDL
# path suffixes to search inside ENV{SDLDIR}
include/SDL include/SDL12 include/SDL11 include
) )
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)

View File

@ -54,7 +54,9 @@ find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
HINTS HINTS
ENV SDLMIXERDIR ENV SDLMIXERDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include PATH_SUFFIXES SDL
# path suffixes to search inside ENV{SDLDIR}
include/SDL include/SDL12 include/SDL11 include
) )
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)

View File

@ -54,7 +54,9 @@ find_path(SDL_NET_INCLUDE_DIR SDL_net.h
HINTS HINTS
ENV SDLNETDIR ENV SDLNETDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include PATH_SUFFIXES SDL
# path suffixes to search inside ENV{SDLDIR}
include/SDL include/SDL12 include/SDL11 include
) )
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)

View File

@ -98,7 +98,9 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
HINTS HINTS
ENV SDLSOUNDDIR ENV SDLSOUNDDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include PATH_SUFFIXES SDL
# path suffixes to search inside ENV{SDLDIR}
include/SDL include/SDL12 include/SDL11 include
) )
find_library(SDL_SOUND_LIBRARY find_library(SDL_SOUND_LIBRARY

View File

@ -54,7 +54,9 @@ find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
HINTS HINTS
ENV SDLTTFDIR ENV SDLTTFDIR
ENV SDLDIR ENV SDLDIR
PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include PATH_SUFFIXES SDL
# path suffixes to search inside ENV{SDLDIR}
include/SDL include/SDL12 include/SDL11 include
) )
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)

View File

@ -63,32 +63,31 @@ else()
set(CMAKE_THREAD_LIBS_INIT "") set(CMAKE_THREAD_LIBS_INIT "")
set(CMAKE_HAVE_THREADS_LIBRARY 1) set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE) set(Threads_FOUND TRUE)
endif() else()
if(NOT CMAKE_HAVE_THREADS_LIBRARY)
# Do we have -lpthreads # Do we have -lpthreads
CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
if(CMAKE_HAVE_PTHREADS_CREATE) if(CMAKE_HAVE_PTHREADS_CREATE)
set(CMAKE_THREAD_LIBS_INIT "-lpthreads") set(CMAKE_THREAD_LIBS_INIT "-lpthreads")
set(CMAKE_HAVE_THREADS_LIBRARY 1) set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE) set(Threads_FOUND TRUE)
endif() else()
# Ok, how about -lpthread # Ok, how about -lpthread
CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
if(CMAKE_HAVE_PTHREAD_CREATE) if(CMAKE_HAVE_PTHREAD_CREATE)
set(CMAKE_THREAD_LIBS_INIT "-lpthread") set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
endif()
if(CMAKE_SYSTEM MATCHES "SunOS.*")
# On sun also check for -lthread
CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
if(CMAKE_HAVE_THR_CREATE)
set(CMAKE_THREAD_LIBS_INIT "-lthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1) set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE) set(Threads_FOUND TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
# On sun also check for -lthread
CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
if(CMAKE_HAVE_THR_CREATE)
set(CMAKE_THREAD_LIBS_INIT "-lthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(Threads_FOUND TRUE)
endif()
endif() endif()
endif() endif()
endif() endif()
@ -96,7 +95,7 @@ else()
if(NOT CMAKE_HAVE_THREADS_LIBRARY) if(NOT CMAKE_HAVE_THREADS_LIBRARY)
# If we did not found -lpthread, -lpthread, or -lthread, look for -pthread # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
if("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") if("x${THREADS_HAVE_PTHREAD_ARG}" STREQUAL "x")
message(STATUS "Check if compiler accepts -pthread") message(STATUS "Check if compiler accepts -pthread")
try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}

View File

@ -366,18 +366,18 @@ endif()
if(WATCOM) if(WATCOM)
get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH ) get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH )
if(WATCOM17) if(CMAKE_C_COMPILER_VERSION)
set( __install__libs ${CompilerPath}/clbr17.dll set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
${CompilerPath}/mt7r17.dll ${CompilerPath}/plbr17.dll ) else()
endif() set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
if(WATCOM18)
set( __install__libs ${CompilerPath}/clbr18.dll
${CompilerPath}/mt7r18.dll ${CompilerPath}/plbr18.dll )
endif()
if(WATCOM19)
set( __install__libs ${CompilerPath}/clbr19.dll
${CompilerPath}/mt7r19.dll ${CompilerPath}/plbr19.dll )
endif() endif()
string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}")
list(GET _watcom_version_list 0 _watcom_major)
list(GET _watcom_version_list 1 _watcom_minor)
set( __install__libs
${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll
${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll
${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll )
foreach(lib foreach(lib
${__install__libs} ${__install__libs}
) )

View File

@ -0,0 +1,5 @@
include(Platform/Linux)
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "")
# RPath is useless on Android, because we can't determine the installation
# location ahead of time.
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")

View File

@ -21,18 +21,26 @@ set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
# "/boot/system/develop/lib/<subdir>/", which we assume to be the secondary # "/boot/system/develop/lib/<subdir>/", which we assume to be the secondary
# architecture specific subdirectory and extract the name of the architecture # architecture specific subdirectory and extract the name of the architecture
# accordingly. # accordingly.
set(__HAIKU_COMPILER ${CMAKE_C_COMPILER})
if(NOT __HAIKU_COMPILER) # First of all, find a C or C++ compiler we can run. The "arg1" is necessary
# here for compilers such as "distcc gcc-x86" or "ccache gcc-x86"
# TODO See CMakeDetermineCompilerId.cmake for some more things we may want to do.
if(CMAKE_C_COMPILER)
set(__HAIKU_COMPILER ${CMAKE_C_COMPILER})
string (STRIP "${CMAKE_C_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS)
else()
set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER}) set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER})
string (STRIP "${CMAKE_CXX_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS)
endif() endif()
execute_process( execute_process(
COMMAND ${__HAIKU_COMPILER} -print-search-dirs COMMAND ${__HAIKU_COMPILER} ${__HAIKU_COMPILER_FLAGS} -print-search-dirs
OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS
RESULT_VARIABLE _HAIKU_SEARCH_DIRS_FOUND
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH ".*\nlibraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/(:[^\n]*)?\n.*" _dummy "\n${_HAIKU_SEARCH_DIRS}\n") string(REGEX MATCH "libraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n")
set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}") set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}")
if(NOT CMAKE_HAIKU_SECONDARY_ARCH) if(NOT CMAKE_HAIKU_SECONDARY_ARCH)
@ -53,14 +61,12 @@ else()
endif() endif()
list(APPEND CMAKE_SYSTEM_PREFIX_PATH list(APPEND CMAKE_SYSTEM_PREFIX_PATH
/boot/common/non-packaged /boot/system/non-packaged
/boot/common
/boot/system /boot/system
) )
LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES
/boot/common/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} /boot/system/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
/boot/common/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
/boot/system/develop/headers/os /boot/system/develop/headers/os
/boot/system/develop/headers/os/app /boot/system/develop/headers/os/app
/boot/system/develop/headers/os/device /boot/system/develop/headers/os/device
@ -108,8 +114,7 @@ LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES
LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES}) LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES})
LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES
/boot/common/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} /boot/system/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
/boot/common/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
/boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} /boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR}
) )
@ -120,6 +125,6 @@ LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}) LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES})
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH set(CMAKE_INSTALL_PREFIX "/boot/system" CACHE PATH
"Install path prefix, prepended onto install directories." FORCE) "Install path prefix, prepended onto install directories." FORCE)
endif() endif()

View File

@ -87,6 +87,7 @@ macro(__windows_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE}) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE})
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES ${__WINDOWS_GNU_LD_RESPONSE})
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
# We prefer "@" for response files but it is not supported by gcc 3. # We prefer "@" for response files but it is not supported by gcc 3.
@ -103,7 +104,9 @@ macro(__windows_compiler_gnu lang)
endif() endif()
# The GNU 3.x compilers do not support response files (only linkers). # The GNU 3.x compilers do not support response files (only linkers).
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0)
elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS) # Link libraries are generated only for the front-end.
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 0)
else()
# Use "@" to pass the response file to the front-end. # Use "@" to pass the response file to the front-end.
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@")
endif() endif()

View File

@ -241,7 +241,7 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
set(CMAKE_${lang}_COMPILE_OBJECT set(CMAKE_${lang}_COMPILE_OBJECT
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}") "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_COMPILE_PDB>${_FS_${lang}} -c <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
"<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}") "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE

View File

@ -40,7 +40,7 @@ set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib l
set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
set(CMAKE_C_CREATE_IMPORT_LIBRARY set(CMAKE_C_CREATE_IMPORT_LIBRARY
"wlib -c -q -n -b <TARGET_IMPLIB> +'<TARGET_UNQUOTED>'") "wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>")
set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
set(CMAKE_C_LINK_EXECUTABLE set(CMAKE_C_LINK_EXECUTABLE
@ -65,11 +65,10 @@ set(CMAKE_C_CREATE_PREPROCESSED_SOURCE
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
"<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_CREATE_SHARED_MODULE
"wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY set(CMAKE_CXX_CREATE_SHARED_LIBRARY
${CMAKE_CXX_CREATE_SHARED_MODULE} "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option implib=<TARGET_IMPLIB> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) string(REPLACE " option implib=<TARGET_IMPLIB>" ""
CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
# create a C shared library # create a C shared library
set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
@ -78,7 +77,7 @@ set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE})
# create a C++ static library # create a C++ static library
set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b '<TARGET_UNQUOTED>' <LINK_FLAGS> <OBJECTS> ") set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b <TARGET_QUOTED> <LINK_FLAGS> <OBJECTS> ")
# create a C static library # create a C static library
set(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) set(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
@ -94,16 +93,18 @@ if(NOT _CMAKE_WATCOM_VERSION)
set(WATCOM17) set(WATCOM17)
set(WATCOM18) set(WATCOM18)
set(WATCOM19) set(WATCOM19)
if("${_compiler_version}" LESS 12.70) if("${_compiler_id}" STREQUAL "OpenWatcom")
set(WATCOM16 1) if("${_compiler_version}" VERSION_LESS 1.7)
endif() set(WATCOM16 1)
if("${_compiler_version}" EQUAL 12.70) endif()
set(WATCOM17 1) if("${_compiler_version}" VERSION_EQUAL 1.7)
endif() set(WATCOM17 1)
if("${_compiler_version}" EQUAL 12.80) endif()
set(WATCOM18 1) if("${_compiler_version}" VERSION_EQUAL 1.8)
endif() set(WATCOM18 1)
if("${_compiler_version}" EQUAL 12.90) endif()
set(WATCOM19 1) if("${_compiler_version}" VERSION_EQUAL 1.9)
set(WATCOM19 1)
endif()
endif() endif()
endif() endif()

View File

@ -141,7 +141,7 @@ function (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target
set(_moc_extra_parameters_file @${_moc_parameters_file}) set(_moc_extra_parameters_file @${_moc_parameters_file})
add_custom_command(OUTPUT ${outfile} add_custom_command(OUTPUT ${outfile}
COMMAND Qt4::moc ${_moc_extra_parameters_file} COMMAND Qt4::moc ${_moc_extra_parameters_file}
DEPENDS ${infile} DEPENDS ${infile} ${_moc_parameters_file}
${_moc_working_dir} ${_moc_working_dir}
VERBATIM) VERBATIM)
endfunction () endfunction ()

View File

@ -426,6 +426,7 @@ function(add_jar _TARGET_NAME)
set(_JAVA_DEPENDS) set(_JAVA_DEPENDS)
set(_JAVA_COMPILE_DEPENDS) set(_JAVA_COMPILE_DEPENDS)
set(_JAVA_RESOURCE_FILES) set(_JAVA_RESOURCE_FILES)
set(_JAVA_RESOURCE_FILES_RELATIVE)
foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE)
@ -462,7 +463,8 @@ function(add_jar _TARGET_NAME)
__java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE}
${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}
"Copying ${_JAVA_SOURCE_FILE} to the build directory") "Copying ${_JAVA_SOURCE_FILE} to the build directory")
list(APPEND _JAVA_RESOURCE_FILES ${_JAVA_SOURCE_FILE}) list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE})
list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE})
endif () endif ()
endforeach() endforeach()
@ -529,7 +531,7 @@ function(add_jar _TARGET_NAME)
OUTPUT ${_JAVA_JAR_OUTPUT_PATH} OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE} COMMAND ${Java_JAR_EXECUTABLE}
-cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
${_JAVA_RESOURCE_FILES} @java_class_filelist ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
-D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
@ -549,7 +551,7 @@ function(add_jar _TARGET_NAME)
OUTPUT ${_JAVA_JAR_OUTPUT_PATH} OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
COMMAND ${Java_JAR_EXECUTABLE} COMMAND ${Java_JAR_EXECUTABLE}
-cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
${_JAVA_RESOURCE_FILES} @java_class_filelist ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
-D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}

View File

@ -98,7 +98,9 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR}) include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR})
endif(QT_INCLUDE_DIRS_NO_SYSTEM) endif(QT_INCLUDE_DIRS_NO_SYSTEM)
endif() endif()
set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY}) if(QT_USE_${module} OR QT_IS_STATIC)
set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
endif()
set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS}) set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
if(QT_IS_STATIC) if(QT_IS_STATIC)
set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES}) set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})

View File

@ -40,5 +40,7 @@
<FeatureRef Id="ProductFeature"/> <FeatureRef Id="ProductFeature"/>
<UIRef Id="$(var.CPACK_WIX_UI_REF)" /> <UIRef Id="$(var.CPACK_WIX_UI_REF)" />
<?include "properties.wxi"?>
</Product> </Product>
</Wix> </Wix>

View File

@ -18,12 +18,34 @@ else()
endif() endif()
if(HAVE_ELF_H) if(HAVE_ELF_H)
set(CMAKE_USE_ELF_PARSER 1) set(CMAKE_USE_ELF_PARSER 1)
elseif(HAIKU)
# On Haiku, we need to include elf32.h from the private headers
set(CMake_HAIKU_INCLUDE_DIRS
/boot/system/develop/headers/private/system
/boot/system/develop/headers/private/system/arch/x86
)
set(CMAKE_REQUIRED_INCLUDES ${CMake_HAIKU_INCLUDE_DIRS})
CHECK_INCLUDE_FILE("elf32.h" HAVE_ELF32_H)
unset(CMAKE_REQUIRED_INCLUDES)
if(HAVE_ELF32_H)
set(CMAKE_USE_ELF_PARSER 1)
else()
unset(CMake_HAIKU_INCLUDE_DIRS)
set(CMAKE_USE_ELF_PARSER)
endif()
else() else()
set(CMAKE_USE_ELF_PARSER) set(CMAKE_USE_ELF_PARSER)
endif() endif()
set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR})
# ensure Unicode friendly APIs are used on Windows
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE)
endif()
# configure the .h file # configure the .h file
configure_file( configure_file(
"${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in" "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in"
@ -52,6 +74,7 @@ include_directories(
${CMAKE_EXPAT_INCLUDES} ${CMAKE_EXPAT_INCLUDES}
${CMAKE_TAR_INCLUDES} ${CMAKE_TAR_INCLUDES}
${CMAKE_COMPRESS_INCLUDES} ${CMAKE_COMPRESS_INCLUDES}
${CMake_HAIKU_INCLUDE_DIRS}
) )
# let cmake know it is supposed to use it # let cmake know it is supposed to use it
@ -399,7 +422,6 @@ if (WIN32)
cmGlobalVisualStudio12Generator.cxx cmGlobalVisualStudio12Generator.cxx
cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.cxx
cmGlobalVisualStudioGenerator.h cmGlobalVisualStudioGenerator.h
cmGlobalWatcomWMakeGenerator.cxx
cmIDEFlagTable.h cmIDEFlagTable.h
cmIDEOptions.cxx cmIDEOptions.cxx
cmIDEOptions.h cmIDEOptions.h
@ -419,6 +441,15 @@ if (WIN32)
endif() endif()
endif () endif ()
# Watcom support
if(WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set_property(SOURCE cmake.cxx APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_USE_WMAKE)
list(APPEND SRCS
cmGlobalWatcomWMakeGenerator.cxx
cmGlobalWatcomWMakeGenerator.h
)
endif()
# Ninja support # Ninja support
set(SRCS ${SRCS} set(SRCS ${SRCS}
cmGlobalNinjaGenerator.cxx cmGlobalNinjaGenerator.cxx
@ -562,7 +593,11 @@ if(WIN32)
set(CPACK_SRCS ${CPACK_SRCS} set(CPACK_SRCS ${CPACK_SRCS}
CPack/WiX/cmCPackWIXGenerator.cxx CPack/WiX/cmCPackWIXGenerator.cxx
CPack/WiX/cmWIXSourceWriter.cxx CPack/WiX/cmWIXSourceWriter.cxx
CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
CPack/WiX/cmWIXFeaturesSourceWriter.cxx
CPack/WiX/cmWIXFilesSourceWriter.cxx
CPack/WiX/cmWIXRichTextFormatWriter.cxx CPack/WiX/cmWIXRichTextFormatWriter.cxx
CPack/WiX/cmWIXPatch.cxx
CPack/WiX/cmWIXPatchParser.cxx CPack/WiX/cmWIXPatchParser.cxx
) )
endif() endif()

View File

@ -1,5 +1,5 @@
# CMake version number components. # CMake version number components.
set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 0) set(CMake_VERSION_MINOR 0)
set(CMake_VERSION_PATCH 0) set(CMake_VERSION_PATCH 20140327)
set(CMake_VERSION_RC 3) #set(CMake_VERSION_RC 1)

View File

@ -1,6 +1,6 @@
/*============================================================================ /*============================================================================
CMake - Cross Platform Makefile Generator CMake - Cross Platform Makefile Generator
Copyright 2000-2013 Kitware, Inc., Insight Software Consortium Copyright 2000-2014 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License"); Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details. see accompanying file Copyright.txt for details.
@ -19,6 +19,9 @@
#include <CPack/cmCPackComponentGroup.h> #include <CPack/cmCPackComponentGroup.h>
#include "cmWIXSourceWriter.h" #include "cmWIXSourceWriter.h"
#include "cmWIXDirectoriesSourceWriter.h"
#include "cmWIXFeaturesSourceWriter.h"
#include "cmWIXFilesSourceWriter.h"
#include "cmWIXRichTextFormatWriter.h" #include "cmWIXRichTextFormatWriter.h"
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
@ -28,11 +31,9 @@
#include <rpc.h> // for GUID generation #include <rpc.h> // for GUID generation
#include <sys/types.h>
#include <sys/stat.h>
cmCPackWIXGenerator::cmCPackWIXGenerator(): cmCPackWIXGenerator::cmCPackWIXGenerator():
HasDesktopShortcuts(false) HasDesktopShortcuts(false),
Patch(Logger)
{ {
} }
@ -44,15 +45,9 @@ int cmCPackWIXGenerator::InitializeInternal()
return this->Superclass::InitializeInternal(); return this->Superclass::InitializeInternal();
} }
bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command) bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command)
{ {
std::string cpackTopLevel; std::string logFileName = this->CPackTopLevel + "/wix.log";
if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
{
return false;
}
std::string logFileName = cpackTopLevel + "/wix.log";
cmCPackLogger(cmCPackLog::LOG_DEBUG, cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Running WiX command: " << command << std::endl); "Running WiX command: " << command << std::endl);
@ -81,7 +76,7 @@ bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command)
} }
bool cmCPackWIXGenerator::RunCandleCommand( bool cmCPackWIXGenerator::RunCandleCommand(
const std::string& sourceFile, const std::string& objectFile) std::string const& sourceFile, std::string const& objectFile)
{ {
std::string executable; std::string executable;
if(!RequireOption("CPACK_WIX_CANDLE_EXECUTABLE", executable)) if(!RequireOption("CPACK_WIX_CANDLE_EXECUTABLE", executable))
@ -108,7 +103,7 @@ bool cmCPackWIXGenerator::RunCandleCommand(
return RunWiXCommand(command.str()); return RunWiXCommand(command.str());
} }
bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles) bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles)
{ {
std::string executable; std::string executable;
if(!RequireOption("CPACK_WIX_LIGHT_EXECUTABLE", executable)) if(!RequireOption("CPACK_WIX_LIGHT_EXECUTABLE", executable))
@ -121,8 +116,8 @@ bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles)
command << " -nologo"; command << " -nologo";
command << " -out " << QuotePath(packageFileNames.at(0)); command << " -out " << QuotePath(packageFileNames.at(0));
for(extension_set_t::const_iterator i = LightExtensions.begin(); for(extension_set_t::const_iterator i = this->LightExtensions.begin();
i != LightExtensions.end(); ++i) i != this->LightExtensions.end(); ++i)
{ {
command << " -ext " << QuotePath(*i); command << " -ext " << QuotePath(*i);
} }
@ -182,15 +177,14 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
"you might want to set this explicitly." << std::endl); "you might want to set this explicitly." << std::endl);
} }
std::string cpackTopLevel; if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", this->CPackTopLevel))
if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
{ {
return false; return false;
} }
if(GetOption("CPACK_WIX_LICENSE_RTF") == 0) if(GetOption("CPACK_WIX_LICENSE_RTF") == 0)
{ {
std::string licenseFilename = cpackTopLevel + "/License.rtf"; std::string licenseFilename = this->CPackTopLevel + "/License.rtf";
SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename.c_str()); SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename.c_str());
if(!CreateLicenseFile()) if(!CreateLicenseFile())
@ -213,7 +207,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
{ {
std::string defaultRef = "WixUI_InstallDir"; std::string defaultRef = "WixUI_InstallDir";
if(Components.size()) if(this->Components.size())
{ {
defaultRef = "WixUI_FeatureTree"; defaultRef = "WixUI_FeatureTree";
} }
@ -221,17 +215,24 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
SetOption("CPACK_WIX_UI_REF", defaultRef.c_str()); SetOption("CPACK_WIX_UI_REF", defaultRef.c_str());
} }
CollectExtensions("CPACK_WIX_EXTENSIONS", CandleExtensions); const char* packageContact = GetOption("CPACK_PACKAGE_CONTACT");
CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", CandleExtensions); if(packageContact != 0 &&
GetOption("CPACK_WIX_PROPERTY_ARPCONTACT") == 0)
{
SetOption("CPACK_WIX_PROPERTY_ARPCONTACT", packageContact);
}
LightExtensions.insert("WixUIExtension"); CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions);
CollectExtensions("CPACK_WIX_EXTENSIONS", LightExtensions); CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", this->CandleExtensions);
CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", LightExtensions);
this->LightExtensions.insert("WixUIExtension");
CollectExtensions("CPACK_WIX_EXTENSIONS", this->LightExtensions);
CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", this->LightExtensions);
const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE"); const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
if(patchFilePath) if(patchFilePath)
{ {
LoadPatchFragments(patchFilePath); this->Patch.LoadFragments(patchFilePath);
} }
return true; return true;
@ -244,10 +245,8 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
return false; return false;
} }
if(!CreateWiXVariablesIncludeFile()) CreateWiXVariablesIncludeFile();
{ CreateWiXPropertiesIncludeFile();
return false;
}
if(!CreateWiXSourceFiles()) if(!CreateWiXSourceFiles())
{ {
@ -257,9 +256,9 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
AppendUserSuppliedExtraSources(); AppendUserSuppliedExtraSources();
std::stringstream objectFiles; std::stringstream objectFiles;
for(size_t i = 0; i < WixSources.size(); ++i) for(size_t i = 0; i < this->WixSources.size(); ++i)
{ {
const std::string& sourceFilename = WixSources[i]; std::string const& sourceFilename = this->WixSources[i];
std::string objectFilename = std::string objectFilename =
cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj"; cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj";
@ -282,7 +281,7 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraSources()
const char *cpackWixExtraSources = GetOption("CPACK_WIX_EXTRA_SOURCES"); const char *cpackWixExtraSources = GetOption("CPACK_WIX_EXTRA_SOURCES");
if(!cpackWixExtraSources) return; if(!cpackWixExtraSources) return;
cmSystemTools::ExpandListArgument(cpackWixExtraSources, WixSources); cmSystemTools::ExpandListArgument(cpackWixExtraSources, this->WixSources);
} }
void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream) void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
@ -297,22 +296,18 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
for(size_t i = 0; i < expandedExtraObjects.size(); ++i) for(size_t i = 0; i < expandedExtraObjects.size(); ++i)
{ {
stream << " " << QuotePath(expandedExtraObjects[i]); stream << " " << QuotePath(expandedExtraObjects[i]);
} }
} }
bool cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
{ {
std::string cpackTopLevel;
if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
{
return false;
}
std::string includeFilename = std::string includeFilename =
cpackTopLevel + "/cpack_variables.wxi"; this->CPackTopLevel + "/cpack_variables.wxi";
cmWIXSourceWriter includeFile(
this->Logger, includeFilename, true);
cmWIXSourceWriter includeFile(Logger, includeFilename, true);
CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID"); CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID");
CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID"); CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID");
CopyDefinition(includeFile, "CPACK_PACKAGE_VENDOR"); CopyDefinition(includeFile, "CPACK_PACKAGE_VENDOR");
@ -326,12 +321,39 @@ bool cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
GetOption("CPACK_PACKAGE_NAME")); GetOption("CPACK_PACKAGE_NAME"));
CopyDefinition(includeFile, "CPACK_WIX_PROGRAM_MENU_FOLDER"); CopyDefinition(includeFile, "CPACK_WIX_PROGRAM_MENU_FOLDER");
CopyDefinition(includeFile, "CPACK_WIX_UI_REF"); CopyDefinition(includeFile, "CPACK_WIX_UI_REF");
}
return true; void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
{
std::string includeFilename =
this->CPackTopLevel + "/properties.wxi";
cmWIXSourceWriter includeFile(
this->Logger, includeFilename, true);
std::string prefix = "CPACK_WIX_PROPERTY_";
std::vector<std::string> options = GetOptions();
for(size_t i = 0; i < options.size(); ++i)
{
std::string const& name = options[i];
if(name.length() > prefix.length() &&
name.substr(0, prefix.length()) == prefix)
{
std::string id = name.substr(prefix.length());
std::string value = GetOption(name.c_str());
includeFile.BeginElement("Property");
includeFile.AddAttribute("Id", id);
includeFile.AddAttribute("Value", value);
includeFile.EndElement("Property");
}
}
} }
void cmCPackWIXGenerator::CopyDefinition( void cmCPackWIXGenerator::CopyDefinition(
cmWIXSourceWriter &source, const std::string &name) cmWIXSourceWriter &source, std::string const& name)
{ {
const char* value = GetOption(name.c_str()); const char* value = GetOption(name.c_str());
if(value) if(value)
@ -341,7 +363,7 @@ void cmCPackWIXGenerator::CopyDefinition(
} }
void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source,
const std::string& name, const std::string& value) std::string const& name, std::string const& value)
{ {
std::stringstream tmp; std::stringstream tmp;
tmp << name << "=\"" << value << '"'; tmp << name << "=\"" << value << '"';
@ -352,81 +374,47 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source,
bool cmCPackWIXGenerator::CreateWiXSourceFiles() bool cmCPackWIXGenerator::CreateWiXSourceFiles()
{ {
std::string cpackTopLevel; std::string directoryDefinitionsFilename =
if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) this->CPackTopLevel + "/directories.wxs";
this->WixSources.push_back(directoryDefinitionsFilename);
cmWIXDirectoriesSourceWriter directoryDefinitions(
this->Logger, directoryDefinitionsFilename);
directoryDefinitions.BeginElement("Fragment");
std::string installRoot;
if(!RequireOption("CPACK_PACKAGE_INSTALL_DIRECTORY", installRoot))
{ {
return false; return false;
} }
std::string directoryDefinitionsFilename =
cpackTopLevel + "/directories.wxs";
WixSources.push_back(directoryDefinitionsFilename);
cmWIXSourceWriter directoryDefinitions(Logger, directoryDefinitionsFilename);
directoryDefinitions.BeginElement("Fragment");
directoryDefinitions.BeginElement("Directory"); directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", "TARGETDIR"); directoryDefinitions.AddAttribute("Id", "TARGETDIR");
directoryDefinitions.AddAttribute("Name", "SourceDir"); directoryDefinitions.AddAttribute("Name", "SourceDir");
directoryDefinitions.BeginElement("Directory"); size_t installRootSize =
if(GetArchitecture() == "x86") directoryDefinitions.BeginInstallationPrefixDirectory(
{ GetProgramFilesFolderId(), installRoot);
directoryDefinitions.AddAttribute("Id", "ProgramFilesFolder");
}
else
{
directoryDefinitions.AddAttribute("Id", "ProgramFiles64Folder");
}
std::vector<std::string> install_root;
std::string tmp;
if(!RequireOption("CPACK_PACKAGE_INSTALL_DIRECTORY", tmp))
{
return false;
}
cmSystemTools::SplitPath(tmp.c_str(), install_root);
if(!install_root.empty() && install_root.back().empty())
{
install_root.pop_back();
}
for(size_t i = 1; i < install_root.size(); ++i)
{
directoryDefinitions.BeginElement("Directory");
if(i == install_root.size() - 1)
{
directoryDefinitions.AddAttribute("Id", "INSTALL_ROOT");
}
else
{
std::stringstream ss;
ss << "INSTALL_PREFIX_" << i;
directoryDefinitions.AddAttribute("Id", ss.str());
}
directoryDefinitions.AddAttribute("Name", install_root[i]);
}
std::string fileDefinitionsFilename = std::string fileDefinitionsFilename =
cpackTopLevel + "/files.wxs"; this->CPackTopLevel + "/files.wxs";
WixSources.push_back(fileDefinitionsFilename); this->WixSources.push_back(fileDefinitionsFilename);
cmWIXFilesSourceWriter fileDefinitions(
this->Logger, fileDefinitionsFilename);
cmWIXSourceWriter fileDefinitions(Logger, fileDefinitionsFilename);
fileDefinitions.BeginElement("Fragment"); fileDefinitions.BeginElement("Fragment");
std::string featureDefinitionsFilename = std::string featureDefinitionsFilename =
cpackTopLevel +"/features.wxs"; this->CPackTopLevel +"/features.wxs";
WixSources.push_back(featureDefinitionsFilename); this->WixSources.push_back(featureDefinitionsFilename);
cmWIXFeaturesSourceWriter featureDefinitions(
this->Logger, featureDefinitionsFilename);
cmWIXSourceWriter featureDefinitions(Logger, featureDefinitionsFilename);
featureDefinitions.BeginElement("Fragment"); featureDefinitions.BeginElement("Fragment");
featureDefinitions.BeginElement("Feature"); featureDefinitions.BeginElement("Feature");
@ -439,13 +427,15 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
{ {
return false; return false;
} }
featureDefinitions.AddAttribute("Title", cpackPackageName);
featureDefinitions.AddAttribute("Title", cpackPackageName);
featureDefinitions.AddAttribute("Level", "1"); featureDefinitions.AddAttribute("Level", "1");
if(!CreateCMakePackageRegistryEntry(featureDefinitions)) const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY");
if(package)
{ {
return false; featureDefinitions.CreateCMakePackageRegistryEntry(
package, GetOption("CPACK_WIX_UPGRADE_GUID"));
} }
if(!CreateFeatureHierarchy(featureDefinitions)) if(!CreateFeatureHierarchy(featureDefinitions))
@ -471,7 +461,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
else else
{ {
for(std::map<std::string, cmCPackComponent>::const_iterator for(std::map<std::string, cmCPackComponent>::const_iterator
i = Components.begin(); i != Components.end(); ++i) i = this->Components.begin(); i != this->Components.end(); ++i)
{ {
cmCPackComponent const& component = i->second; cmCPackComponent const& component = i->second;
@ -513,31 +503,51 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
featureDefinitions.EndElement("Fragment"); featureDefinitions.EndElement("Fragment");
fileDefinitions.EndElement("Fragment"); fileDefinitions.EndElement("Fragment");
for(size_t i = 1; i < install_root.size(); ++i) directoryDefinitions.EndInstallationPrefixDirectory(
{ installRootSize);
directoryDefinitions.EndElement("Directory");
}
directoryDefinitions.EndElement("Directory");
if(hasShortcuts) if(hasShortcuts)
{ {
CreateStartMenuFolder(directoryDefinitions); directoryDefinitions.EmitStartMenuFolder(
GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER"));
} }
if(this->HasDesktopShortcuts) if(this->HasDesktopShortcuts)
{ {
CreateDesktopFolder(directoryDefinitions); directoryDefinitions.EmitDesktopFolder();
} }
directoryDefinitions.EndElement("Directory"); directoryDefinitions.EndElement("Directory");
directoryDefinitions.EndElement("Fragment"); directoryDefinitions.EndElement("Fragment");
if(!GenerateMainSourceFileFromTemplate())
{
return false;
}
return this->Patch.CheckForUnappliedFragments();
}
std::string cmCPackWIXGenerator::GetProgramFilesFolderId() const
{
if(GetArchitecture() == "x86")
{
return "ProgramFilesFolder";
}
else
{
return "ProgramFiles64Folder";
}
}
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
{
std::string wixTemplate = FindTemplate("WIX.template.in"); std::string wixTemplate = FindTemplate("WIX.template.in");
if(GetOption("CPACK_WIX_TEMPLATE") != 0) if(GetOption("CPACK_WIX_TEMPLATE") != 0)
{ {
wixTemplate = GetOption("CPACK_WIX_TEMPLATE"); wixTemplate = GetOption("CPACK_WIX_TEMPLATE");
} }
if(wixTemplate.empty()) if(wixTemplate.empty())
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, cmCPackLogger(cmCPackLog::LOG_ERROR,
@ -545,7 +555,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return false; return false;
} }
std::string mainSourceFilePath = cpackTopLevel + "/main.wxs"; std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs";
if(!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath .c_str())) if(!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath .c_str()))
{ {
@ -556,68 +566,13 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return false; return false;
} }
WixSources.push_back(mainSourceFilePath); this->WixSources.push_back(mainSourceFilePath);
std::string fragmentList;
for(cmWIXPatchParser::fragment_map_t::const_iterator
i = Fragments.begin(); i != Fragments.end(); ++i)
{
if(!fragmentList.empty())
{
fragmentList += ", ";
}
fragmentList += "'";
fragmentList += i->first;
fragmentList += "'";
}
if(fragmentList.size())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Some XML patch fragments did not have matching IDs: " <<
fragmentList << std::endl);
return false;
}
return true;
}
bool cmCPackWIXGenerator::CreateCMakePackageRegistryEntry(
cmWIXSourceWriter& featureDefinitions)
{
const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY");
if(!package)
{
return true;
}
featureDefinitions.BeginElement("Component");
featureDefinitions.AddAttribute("Id", "CM_PACKAGE_REGISTRY");
featureDefinitions.AddAttribute("Directory", "TARGETDIR");
featureDefinitions.AddAttribute("Guid", "*");
std::string registryKey =
std::string("Software\\Kitware\\CMake\\Packages\\") + package;
std::string upgradeGuid = GetOption("CPACK_WIX_UPGRADE_GUID");
featureDefinitions.BeginElement("RegistryValue");
featureDefinitions.AddAttribute("Root", "HKLM");
featureDefinitions.AddAttribute("Key", registryKey);
featureDefinitions.AddAttribute("Name", upgradeGuid);
featureDefinitions.AddAttribute("Type", "string");
featureDefinitions.AddAttribute("Value", "[INSTALL_ROOT]");
featureDefinitions.AddAttribute("KeyPath", "yes");
featureDefinitions.EndElement("RegistryValue");
featureDefinitions.EndElement("Component");
return true; return true;
} }
bool cmCPackWIXGenerator::CreateFeatureHierarchy( bool cmCPackWIXGenerator::CreateFeatureHierarchy(
cmWIXSourceWriter& featureDefinitions) cmWIXFeaturesSourceWriter& featureDefinitions)
{ {
for(std::map<std::string, cmCPackComponentGroup>::const_iterator for(std::map<std::string, cmCPackComponentGroup>::const_iterator
i = ComponentGroups.begin(); i != ComponentGroups.end(); ++i) i = ComponentGroups.begin(); i != ComponentGroups.end(); ++i)
@ -625,105 +580,30 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy(
cmCPackComponentGroup const& group = i->second; cmCPackComponentGroup const& group = i->second;
if(group.ParentGroup == 0) if(group.ParentGroup == 0)
{ {
if(!EmitFeatureForComponentGroup(featureDefinitions, group)) featureDefinitions.EmitFeatureForComponentGroup(group);
{
return false;
}
} }
} }
for(std::map<std::string, cmCPackComponent>::const_iterator for(std::map<std::string, cmCPackComponent>::const_iterator
i = Components.begin(); i != Components.end(); ++i) i = this->Components.begin(); i != this->Components.end(); ++i)
{ {
cmCPackComponent const& component = i->second; cmCPackComponent const& component = i->second;
if(!component.Group) if(!component.Group)
{ {
if(!EmitFeatureForComponent(featureDefinitions, component)) featureDefinitions.EmitFeatureForComponent(component);
{
return false;
}
} }
} }
return true; return true;
} }
bool cmCPackWIXGenerator::EmitFeatureForComponentGroup(
cmWIXSourceWriter& featureDefinitions,
cmCPackComponentGroup const& group)
{
featureDefinitions.BeginElement("Feature");
featureDefinitions.AddAttribute("Id", "CM_G_" + group.Name);
if(group.IsExpandedByDefault)
{
featureDefinitions.AddAttribute("Display", "expand");
}
featureDefinitions.AddAttributeUnlessEmpty(
"Title", group.DisplayName);
featureDefinitions.AddAttributeUnlessEmpty(
"Description", group.Description);
for(std::vector<cmCPackComponentGroup*>::const_iterator
i = group.Subgroups.begin(); i != group.Subgroups.end(); ++i)
{
if(!EmitFeatureForComponentGroup(featureDefinitions, **i))
{
return false;
}
}
for(std::vector<cmCPackComponent*>::const_iterator
i = group.Components.begin(); i != group.Components.end(); ++i)
{
if(!EmitFeatureForComponent(featureDefinitions, **i))
{
return false;
}
}
featureDefinitions.EndElement("Feature");
return true;
}
bool cmCPackWIXGenerator::EmitFeatureForComponent(
cmWIXSourceWriter& featureDefinitions,
cmCPackComponent const& component)
{
featureDefinitions.BeginElement("Feature");
featureDefinitions.AddAttribute("Id", "CM_C_" + component.Name);
featureDefinitions.AddAttributeUnlessEmpty(
"Title", component.DisplayName);
featureDefinitions.AddAttributeUnlessEmpty(
"Description", component.Description);
if(component.IsRequired)
{
featureDefinitions.AddAttribute("Absent", "disallow");
}
if(component.IsHidden)
{
featureDefinitions.AddAttribute("Display", "hidden");
}
featureDefinitions.EndElement("Feature");
return true;
}
bool cmCPackWIXGenerator::AddComponentsToFeature( bool cmCPackWIXGenerator::AddComponentsToFeature(
std::string const& rootPath, std::string const& rootPath,
std::string const& featureId, std::string const& featureId,
cmWIXSourceWriter& directoryDefinitions, cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXSourceWriter& fileDefinitions, cmWIXFilesSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions,
shortcut_map_t& shortcutMap) shortcut_map_t& shortcutMap)
{ {
featureDefinitions.BeginElement("FeatureRef"); featureDefinitions.BeginElement("FeatureRef");
@ -768,8 +648,8 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts(
std::string const& cpackComponentName, std::string const& cpackComponentName,
std::string const& featureId, std::string const& featureId,
shortcut_map_t& shortcutMap, shortcut_map_t& shortcutMap,
cmWIXSourceWriter& fileDefinitions, cmWIXFilesSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions) cmWIXFeaturesSourceWriter& featureDefinitions)
{ {
bool thisHasDesktopShortcuts = false; bool thisHasDesktopShortcuts = false;
@ -799,6 +679,7 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts(
fileDefinitions.BeginElement("DirectoryRef"); fileDefinitions.BeginElement("DirectoryRef");
fileDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER"); fileDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER");
fileDefinitions.BeginElement("Component"); fileDefinitions.BeginElement("Component");
fileDefinitions.AddAttribute("Id", componentId); fileDefinitions.AddAttribute("Id", componentId);
fileDefinitions.AddAttribute("Guid", "*"); fileDefinitions.AddAttribute("Guid", "*");
@ -809,63 +690,34 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts(
std::string const& id = i->first; std::string const& id = i->first;
cmWIXShortcut const& shortcut = i->second; cmWIXShortcut const& shortcut = i->second;
std::string shortcutId = std::string("CM_S") + id; fileDefinitions.EmitShortcut(id, shortcut, false);
std::string fileId = std::string("CM_F") + id;
fileDefinitions.BeginElement("Shortcut"); if(shortcut.desktop)
fileDefinitions.AddAttribute("Id", shortcutId);
fileDefinitions.AddAttribute("Name", shortcut.textLabel);
std::string target = "[#" + fileId + "]";
fileDefinitions.AddAttribute("Target", target);
fileDefinitions.AddAttribute("WorkingDirectory",
shortcut.workingDirectoryId);
fileDefinitions.EndElement("Shortcut");
if (shortcut.desktop)
{ {
thisHasDesktopShortcuts = true; thisHasDesktopShortcuts = true;
} }
} }
if(cpackComponentName.empty()) if(cpackComponentName.empty())
{ {
CreateUninstallShortcut(cpackPackageName, fileDefinitions); fileDefinitions.EmitUninstallShortcut(cpackPackageName);
} }
fileDefinitions.BeginElement("RemoveFolder"); fileDefinitions.EmitRemoveFolder(
fileDefinitions.AddAttribute("Id",
"CM_REMOVE_PROGRAM_MENU_FOLDER" + idSuffix); "CM_REMOVE_PROGRAM_MENU_FOLDER" + idSuffix);
fileDefinitions.AddAttribute("On", "uninstall");
fileDefinitions.EndElement("RemoveFolder");
std::string registryKey = std::string registryKey =
std::string("Software\\") + cpackVendor + "\\" + cpackPackageName; std::string("Software\\") + cpackVendor + "\\" + cpackPackageName;
fileDefinitions.BeginElement("RegistryValue"); fileDefinitions.EmitStartMenuShortcutRegistryValue(
fileDefinitions.AddAttribute("Root", "HKCU"); registryKey, cpackComponentName);
fileDefinitions.AddAttribute("Key", registryKey);
std::string valueName;
if(!cpackComponentName.empty())
{
valueName = cpackComponentName + "_";
}
valueName += "installed";
fileDefinitions.AddAttribute("Name", valueName);
fileDefinitions.AddAttribute("Type", "integer");
fileDefinitions.AddAttribute("Value", "1");
fileDefinitions.AddAttribute("KeyPath", "yes");
fileDefinitions.EndElement("RegistryValue");
fileDefinitions.EndElement("Component"); fileDefinitions.EndElement("Component");
fileDefinitions.EndElement("DirectoryRef"); fileDefinitions.EndElement("DirectoryRef");
featureDefinitions.BeginElement("ComponentRef"); featureDefinitions.EmitComponentRef(componentId);
featureDefinitions.AddAttribute("Id", componentId);
featureDefinitions.EndElement("ComponentRef");
if (thisHasDesktopShortcuts) if(thisHasDesktopShortcuts)
{ {
this->HasDesktopShortcuts = true; this->HasDesktopShortcuts = true;
componentId = "CM_DESKTOP_SHORTCUT" + idSuffix; componentId = "CM_DESKTOP_SHORTCUT" + idSuffix;
@ -876,7 +728,7 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts(
fileDefinitions.AddAttribute("Id", componentId); fileDefinitions.AddAttribute("Id", componentId);
fileDefinitions.AddAttribute("Guid", "*"); fileDefinitions.AddAttribute("Guid", "*");
for (shortcut_map_t::const_iterator for(shortcut_map_t::const_iterator
i = shortcutMap.begin(); i != shortcutMap.end(); ++i) i = shortcutMap.begin(); i != shortcutMap.end(); ++i)
{ {
std::string const& id = i->first; std::string const& id = i->first;
@ -885,34 +737,16 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts(
if (!shortcut.desktop) if (!shortcut.desktop)
continue; continue;
std::string shortcutId = std::string("CM_DS") + id; fileDefinitions.EmitShortcut(id, shortcut, true);
std::string fileId = std::string("CM_F") + id;
fileDefinitions.BeginElement("Shortcut");
fileDefinitions.AddAttribute("Id", shortcutId);
fileDefinitions.AddAttribute("Name", shortcut.textLabel);
std::string target = "[#" + fileId + "]";
fileDefinitions.AddAttribute("Target", target);
fileDefinitions.AddAttribute("WorkingDirectory",
shortcut.workingDirectoryId);
fileDefinitions.EndElement("Shortcut");
} }
fileDefinitions.BeginElement("RegistryValue"); fileDefinitions.EmitDesktopShortcutRegistryValue(
fileDefinitions.AddAttribute("Root", "HKCU"); registryKey, cpackComponentName);
fileDefinitions.AddAttribute("Key", registryKey);
fileDefinitions.AddAttribute("Name", valueName + "_desktop");
fileDefinitions.AddAttribute("Type", "integer");
fileDefinitions.AddAttribute("Value", "1");
fileDefinitions.AddAttribute("KeyPath", "yes");
fileDefinitions.EndElement("RegistryValue");
fileDefinitions.EndElement("Component"); fileDefinitions.EndElement("Component");
fileDefinitions.EndElement("DirectoryRef"); fileDefinitions.EndElement("DirectoryRef");
featureDefinitions.BeginElement("ComponentRef"); featureDefinitions.EmitComponentRef(componentId);
featureDefinitions.AddAttribute("Id", componentId);
featureDefinitions.EndElement("ComponentRef");
} }
featureDefinitions.EndElement("FeatureRef"); featureDefinitions.EndElement("FeatureRef");
@ -920,19 +754,6 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts(
return true; return true;
} }
void cmCPackWIXGenerator::CreateUninstallShortcut(
std::string const& packageName,
cmWIXSourceWriter& fileDefinitions)
{
fileDefinitions.BeginElement("Shortcut");
fileDefinitions.AddAttribute("Id", "UNINSTALL");
fileDefinitions.AddAttribute("Name", "Uninstall " + packageName);
fileDefinitions.AddAttribute("Description", "Uninstalls " + packageName);
fileDefinitions.AddAttribute("Target", "[SystemFolder]msiexec.exe");
fileDefinitions.AddAttribute("Arguments", "/x [ProductCode]");
fileDefinitions.EndElement("Shortcut");
}
bool cmCPackWIXGenerator::CreateLicenseFile() bool cmCPackWIXGenerator::CreateLicenseFile()
{ {
std::string licenseSourceFilename; std::string licenseSourceFilename;
@ -981,11 +802,11 @@ bool cmCPackWIXGenerator::CreateLicenseFile()
} }
void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
const std::string& topdir, std::string const& topdir,
const std::string& directoryId, std::string const& directoryId,
cmWIXSourceWriter& directoryDefinitions, cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXSourceWriter& fileDefinitions, cmWIXFilesSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions,
const std::vector<std::string>& packageExecutables, const std::vector<std::string>& packageExecutables,
const std::vector<std::string>& desktopExecutables, const std::vector<std::string>& desktopExecutables,
shortcut_map_t& shortcutMap) shortcut_map_t& shortcutMap)
@ -993,6 +814,16 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
cmsys::Directory dir; cmsys::Directory dir;
dir.Load(topdir.c_str()); dir.Load(topdir.c_str());
if(dir.GetNumberOfFiles() == 2)
{
std::string componentId = fileDefinitions.EmitComponentCreateFolder(
directoryId, GenerateGUID());
featureDefinitions.EmitComponentRef(componentId);
return;
}
for(size_t i = 0; i < dir.GetNumberOfFiles(); ++i) for(size_t i = 0; i < dir.GetNumberOfFiles(); ++i)
{ {
std::string fileName = dir.GetFile(static_cast<unsigned long>(i)); std::string fileName = dir.GetFile(static_cast<unsigned long>(i));
@ -1026,44 +857,15 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
desktopExecutables, desktopExecutables,
shortcutMap); shortcutMap);
ApplyPatchFragment(subDirectoryId, directoryDefinitions); this->Patch.ApplyFragment(subDirectoryId, directoryDefinitions);
directoryDefinitions.EndElement("Directory"); directoryDefinitions.EndElement("Directory");
} }
else else
{ {
std::string componentId = std::string("CM_C") + id; std::string componentId = fileDefinitions.EmitComponentFile(
std::string fileId = std::string("CM_F") + id; directoryId, id, fullPath, this->Patch);
fileDefinitions.BeginElement("DirectoryRef"); featureDefinitions.EmitComponentRef(componentId);
fileDefinitions.AddAttribute("Id", directoryId);
fileDefinitions.BeginElement("Component");
fileDefinitions.AddAttribute("Id", componentId);
fileDefinitions.AddAttribute("Guid", "*");
fileDefinitions.BeginElement("File");
fileDefinitions.AddAttribute("Id", fileId);
fileDefinitions.AddAttribute("Source", fullPath);
fileDefinitions.AddAttribute("KeyPath", "yes");
mode_t fileMode = 0;
cmSystemTools::GetPermissions(fullPath.c_str(), fileMode);
if(!(fileMode & S_IWRITE))
{
fileDefinitions.AddAttribute("ReadOnly", "yes");
}
ApplyPatchFragment(fileId, fileDefinitions);
fileDefinitions.EndElement("File");
ApplyPatchFragment(componentId, fileDefinitions);
fileDefinitions.EndElement("Component");
fileDefinitions.EndElement("DirectoryRef");
featureDefinitions.BeginElement("ComponentRef");
featureDefinitions.AddAttribute("Id", componentId);
featureDefinitions.EndElement("ComponentRef");
for(size_t j = 0; j < packageExecutables.size(); ++j) for(size_t j = 0; j < packageExecutables.size(); ++j)
{ {
@ -1092,7 +894,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
} }
bool cmCPackWIXGenerator::RequireOption( bool cmCPackWIXGenerator::RequireOption(
const std::string& name, std::string &value) const std::string const& name, std::string &value) const
{ {
const char* tmp = GetOption(name.c_str()); const char* tmp = GetOption(name.c_str());
if(tmp) if(tmp)
@ -1140,13 +942,13 @@ std::string cmCPackWIXGenerator::GenerateGUID()
return cmSystemTools::UpperCase(result); return cmSystemTools::UpperCase(result);
} }
std::string cmCPackWIXGenerator::QuotePath(const std::string& path) std::string cmCPackWIXGenerator::QuotePath(std::string const& path)
{ {
return std::string("\"") + path + '"'; return std::string("\"") + path + '"';
} }
std::string cmCPackWIXGenerator::GetRightmostExtension( std::string cmCPackWIXGenerator::GetRightmostExtension(
const std::string& filename) std::string const& filename)
{ {
std::string extension; std::string extension;
@ -1159,7 +961,7 @@ std::string cmCPackWIXGenerator::GetRightmostExtension(
return cmSystemTools::LowerCase(extension); return cmSystemTools::LowerCase(extension);
} }
std::string cmCPackWIXGenerator::PathToId(const std::string& path) std::string cmCPackWIXGenerator::PathToId(std::string const& path)
{ {
id_map_t::const_iterator i = PathToIdMap.find(path); id_map_t::const_iterator i = PathToIdMap.find(path);
if(i != PathToIdMap.end()) return i->second; if(i != PathToIdMap.end()) return i->second;
@ -1168,7 +970,7 @@ std::string cmCPackWIXGenerator::PathToId(const std::string& path)
return id; return id;
} }
std::string cmCPackWIXGenerator::CreateNewIdForPath(const std::string& path) std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path)
{ {
std::vector<std::string> components; std::vector<std::string> components;
cmSystemTools::SplitPath(path.c_str(), components, false); cmSystemTools::SplitPath(path.c_str(), components, false);
@ -1222,7 +1024,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(const std::string& path)
} }
std::string cmCPackWIXGenerator::CreateHashedId( std::string cmCPackWIXGenerator::CreateHashedId(
const std::string& path, const std::string& normalizedFilename) std::string const& path, std::string const& normalizedFilename)
{ {
cmsys::auto_ptr<cmCryptoHash> sha1 = cmCryptoHash::New("SHA1"); cmsys::auto_ptr<cmCryptoHash> sha1 = cmCryptoHash::New("SHA1");
std::string hash = sha1->HashString(path.c_str()); std::string hash = sha1->HashString(path.c_str());
@ -1245,7 +1047,7 @@ std::string cmCPackWIXGenerator::CreateHashedId(
} }
std::string cmCPackWIXGenerator::NormalizeComponentForId( std::string cmCPackWIXGenerator::NormalizeComponentForId(
const std::string& component, size_t& replacementCount) std::string const& component, size_t& replacementCount)
{ {
std::string result; std::string result;
result.resize(component.size()); result.resize(component.size());
@ -1276,7 +1078,7 @@ bool cmCPackWIXGenerator::IsLegalIdCharacter(char c)
} }
void cmCPackWIXGenerator::CollectExtensions( void cmCPackWIXGenerator::CollectExtensions(
const std::string& variableName, extension_set_t& extensions) std::string const& variableName, extension_set_t& extensions)
{ {
const char *variableContent = GetOption(variableName.c_str()); const char *variableContent = GetOption(variableName.c_str());
if(!variableContent) return; if(!variableContent) return;
@ -1292,7 +1094,7 @@ void cmCPackWIXGenerator::CollectExtensions(
} }
void cmCPackWIXGenerator::AddCustomFlags( void cmCPackWIXGenerator::AddCustomFlags(
const std::string& variableName, std::ostream& stream) std::string const& variableName, std::ostream& stream)
{ {
const char *variableContent = GetOption(variableName.c_str()); const char *variableContent = GetOption(variableName.c_str());
if(!variableContent) return; if(!variableContent) return;
@ -1306,69 +1108,3 @@ void cmCPackWIXGenerator::AddCustomFlags(
stream << " " << QuotePath(*i); stream << " " << QuotePath(*i);
} }
} }
void cmCPackWIXGenerator::CreateStartMenuFolder(
cmWIXSourceWriter& directoryDefinitions)
{
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", "ProgramMenuFolder");
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER");
const char *startMenuFolder = GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
directoryDefinitions.AddAttribute("Name", startMenuFolder);
directoryDefinitions.EndElement("Directory");
directoryDefinitions.EndElement("Directory");
}
void cmCPackWIXGenerator::CreateDesktopFolder(
cmWIXSourceWriter& directoryDefinitions)
{
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", "DesktopFolder");
directoryDefinitions.AddAttribute("Name", "Desktop");
directoryDefinitions.EndElement("Directory");
}
void cmCPackWIXGenerator::LoadPatchFragments(const std::string& patchFilePath)
{
cmWIXPatchParser parser(Fragments, Logger);
parser.ParseFile(patchFilePath.c_str());
}
void cmCPackWIXGenerator::ApplyPatchFragment(
const std::string& id, cmWIXSourceWriter& writer)
{
cmWIXPatchParser::fragment_map_t::iterator i = Fragments.find(id);
if(i == Fragments.end()) return;
const cmWIXPatchElement& fragment = i->second;
for(cmWIXPatchElement::child_list_t::const_iterator
j = fragment.children.begin(); j != fragment.children.end(); ++j)
{
ApplyPatchElement(**j, writer);
}
Fragments.erase(i);
}
void cmCPackWIXGenerator::ApplyPatchElement(
const cmWIXPatchElement& element, cmWIXSourceWriter& writer)
{
writer.BeginElement(element.name);
for(cmWIXPatchElement::attributes_t::const_iterator
i = element.attributes.begin(); i != element.attributes.end(); ++i)
{
writer.AddAttribute(i->first, i->second);
}
for(cmWIXPatchElement::child_list_t::const_iterator
i = element.children.begin(); i != element.children.end(); ++i)
{
ApplyPatchElement(**i, writer);
}
writer.EndElement(element.name);
}

View File

@ -13,25 +13,18 @@
#ifndef cmCPackWIXGenerator_h #ifndef cmCPackWIXGenerator_h
#define cmCPackWIXGenerator_h #define cmCPackWIXGenerator_h
#include "cmWIXPatchParser.h" #include "cmWIXPatch.h"
#include "cmWIXShortcut.h"
#include <CPack/cmCPackGenerator.h> #include <CPack/cmCPackGenerator.h>
#include <string> #include <string>
#include <map> #include <map>
struct cmWIXShortcut
{
cmWIXShortcut()
:desktop(false)
{}
std::string textLabel;
std::string workingDirectoryId;
bool desktop;
};
class cmWIXSourceWriter; class cmWIXSourceWriter;
class cmWIXDirectoriesSourceWriter;
class cmWIXFilesSourceWriter;
class cmWIXFeaturesSourceWriter;
/** \class cmCPackWIXGenerator /** \class cmCPackWIXGenerator
* \brief A generator for WIX files * \brief A generator for WIX files
@ -78,48 +71,39 @@ private:
bool PackageFilesImpl(); bool PackageFilesImpl();
bool CreateWiXVariablesIncludeFile(); void CreateWiXVariablesIncludeFile();
void CreateWiXPropertiesIncludeFile();
void CopyDefinition( void CopyDefinition(
cmWIXSourceWriter &source, const std::string &name); cmWIXSourceWriter &source, std::string const& name);
void AddDefinition(cmWIXSourceWriter& source, void AddDefinition(cmWIXSourceWriter& source,
const std::string& name, const std::string& value); std::string const& name, std::string const& value);
bool CreateWiXSourceFiles(); bool CreateWiXSourceFiles();
bool CreateCMakePackageRegistryEntry( std::string GetProgramFilesFolderId() const;
cmWIXSourceWriter& featureDefinitions);
bool GenerateMainSourceFileFromTemplate();
bool CreateFeatureHierarchy( bool CreateFeatureHierarchy(
cmWIXSourceWriter& featureDefinitions); cmWIXFeaturesSourceWriter& featureDefinitions);
bool EmitFeatureForComponentGroup(
cmWIXSourceWriter& featureDefinitions,
cmCPackComponentGroup const& group);
bool EmitFeatureForComponent(
cmWIXSourceWriter& featureDefinitions,
cmCPackComponent const& component);
bool AddComponentsToFeature( bool AddComponentsToFeature(
std::string const& rootPath, std::string const& rootPath,
std::string const& featureId, std::string const& featureId,
cmWIXSourceWriter& directoryDefinitions, cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXSourceWriter& fileDefinitions, cmWIXFilesSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions,
shortcut_map_t& shortcutMap); shortcut_map_t& shortcutMap);
bool CreateStartMenuShortcuts( bool CreateStartMenuShortcuts(
std::string const& cpackComponentName, std::string const& cpackComponentName,
std::string const& featureId, std::string const& featureId,
shortcut_map_t& shortcutMap, shortcut_map_t& shortcutMap,
cmWIXSourceWriter& fileDefinitions, cmWIXFilesSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions); cmWIXFeaturesSourceWriter& featureDefinitions);
void CreateUninstallShortcut(
std::string const& packageName,
cmWIXSourceWriter& fileDefinitions);
void AppendUserSuppliedExtraSources(); void AppendUserSuppliedExtraSources();
@ -127,60 +111,49 @@ private:
bool CreateLicenseFile(); bool CreateLicenseFile();
bool RunWiXCommand(const std::string& command); bool RunWiXCommand(std::string const& command);
bool RunCandleCommand( bool RunCandleCommand(
const std::string& sourceFile, const std::string& objectFile); std::string const& sourceFile, std::string const& objectFile);
bool RunLightCommand(const std::string& objectFiles); bool RunLightCommand(std::string const& objectFiles);
void AddDirectoryAndFileDefinitons(const std::string& topdir, void AddDirectoryAndFileDefinitons(std::string const& topdir,
const std::string& directoryId, std::string const& directoryId,
cmWIXSourceWriter& directoryDefinitions, cmWIXDirectoriesSourceWriter& directoryDefinitions,
cmWIXSourceWriter& fileDefinitions, cmWIXFilesSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions, cmWIXFeaturesSourceWriter& featureDefinitions,
const std::vector<std::string>& pkgExecutables, const std::vector<std::string>& pkgExecutables,
const std::vector<std::string>& desktopExecutables, const std::vector<std::string>& desktopExecutables,
shortcut_map_t& shortcutMap); shortcut_map_t& shortcutMap);
bool RequireOption(const std::string& name, std::string& value) const; bool RequireOption(std::string const& name, std::string& value) const;
std::string GetArchitecture() const; std::string GetArchitecture() const;
static std::string GenerateGUID(); static std::string GenerateGUID();
static std::string QuotePath(const std::string& path); static std::string QuotePath(std::string const& path);
static std::string GetRightmostExtension(const std::string& filename); static std::string GetRightmostExtension(std::string const& filename);
std::string PathToId(const std::string& path); std::string PathToId(std::string const& path);
std::string CreateNewIdForPath(const std::string& path); std::string CreateNewIdForPath(std::string const& path);
static std::string CreateHashedId( static std::string CreateHashedId(
const std::string& path, const std::string& normalizedFilename); std::string const& path, std::string const& normalizedFilename);
std::string NormalizeComponentForId( std::string NormalizeComponentForId(
const std::string& component, size_t& replacementCount); std::string const& component, size_t& replacementCount);
static bool IsLegalIdCharacter(char c); static bool IsLegalIdCharacter(char c);
void CollectExtensions( void CollectExtensions(
const std::string& variableName, extension_set_t& extensions); std::string const& variableName, extension_set_t& extensions);
void AddCustomFlags( void AddCustomFlags(
const std::string& variableName, std::ostream& stream); std::string const& variableName, std::ostream& stream);
void CreateStartMenuFolder(cmWIXSourceWriter& directoryDefinitions);
void CreateDesktopFolder(cmWIXSourceWriter& directoryDefinitions);
void LoadPatchFragments(const std::string& patchFilePath);
void ApplyPatchFragment(const std::string& id, cmWIXSourceWriter& writer);
void ApplyPatchElement(const cmWIXPatchElement& element,
cmWIXSourceWriter& writer);
std::vector<std::string> WixSources; std::vector<std::string> WixSources;
id_map_t PathToIdMap; id_map_t PathToIdMap;
@ -189,9 +162,11 @@ private:
extension_set_t CandleExtensions; extension_set_t CandleExtensions;
extension_set_t LightExtensions; extension_set_t LightExtensions;
cmWIXPatchParser::fragment_map_t Fragments;
bool HasDesktopShortcuts; bool HasDesktopShortcuts;
std::string CPackTopLevel;
cmWIXPatch Patch;
}; };
#endif #endif

View File

@ -0,0 +1,87 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmWIXDirectoriesSourceWriter.h"
cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter(cmCPackLog* logger,
std::string const& filename):
cmWIXSourceWriter(logger, filename)
{
}
void cmWIXDirectoriesSourceWriter::EmitStartMenuFolder(
std::string const& startMenuFolder)
{
BeginElement("Directory");
AddAttribute("Id", "ProgramMenuFolder");
BeginElement("Directory");
AddAttribute("Id", "PROGRAM_MENU_FOLDER");
AddAttribute("Name", startMenuFolder);
EndElement("Directory");
EndElement("Directory");
}
void cmWIXDirectoriesSourceWriter::EmitDesktopFolder()
{
BeginElement("Directory");
AddAttribute("Id", "DesktopFolder");
AddAttribute("Name", "Desktop");
EndElement("Directory");
}
size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
std::string const& programFilesFolderId,
std::string const& installRootString)
{
BeginElement("Directory");
AddAttribute("Id", programFilesFolderId);
std::vector<std::string> installRoot;
cmSystemTools::SplitPath(installRootString.c_str(), installRoot);
if(!installRoot.empty() && installRoot.back().empty())
{
installRoot.pop_back();
}
for(size_t i = 1; i < installRoot.size(); ++i)
{
BeginElement("Directory");
if(i == installRoot.size() - 1)
{
AddAttribute("Id", "INSTALL_ROOT");
}
else
{
std::stringstream tmp;
tmp << "INSTALL_PREFIX_" << i;
AddAttribute("Id", tmp.str());
}
AddAttribute("Name", installRoot[i]);
}
return installRoot.size();
}
void cmWIXDirectoriesSourceWriter::EndInstallationPrefixDirectory(size_t size)
{
for(size_t i = 0; i < size; ++i)
{
EndElement("Directory");
}
}

View File

@ -0,0 +1,42 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmWIXDirectoriesSourceWriter_h
#define cmWIXDirectoriesSourceWriter_h
#include "cmWIXSourceWriter.h"
#include <CPack/cmCPackGenerator.h>
#include <string>
/** \class cmWIXDirectoriesSourceWriter
* \brief Helper class to generate directories.wxs
*/
class cmWIXDirectoriesSourceWriter : public cmWIXSourceWriter
{
public:
cmWIXDirectoriesSourceWriter(cmCPackLog* logger,
std::string const& filename);
void EmitStartMenuFolder(std::string const& startMenuFolder);
void EmitDesktopFolder();
size_t BeginInstallationPrefixDirectory(
std::string const& programFilesFolderId,
std::string const& installRootString);
void EndInstallationPrefixDirectory(size_t size);
};
#endif

View File

@ -0,0 +1,102 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmWIXFeaturesSourceWriter.h"
cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter(cmCPackLog* logger,
std::string const& filename):
cmWIXSourceWriter(logger, filename)
{
}
void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry(
std::string const& package,
std::string const& upgradeGuid)
{
BeginElement("Component");
AddAttribute("Id", "CM_PACKAGE_REGISTRY");
AddAttribute("Directory", "TARGETDIR");
AddAttribute("Guid", "*");
std::string registryKey =
std::string("Software\\Kitware\\CMake\\Packages\\") + package;
BeginElement("RegistryValue");
AddAttribute("Root", "HKLM");
AddAttribute("Key", registryKey);
AddAttribute("Name", upgradeGuid);
AddAttribute("Type", "string");
AddAttribute("Value", "[INSTALL_ROOT]");
AddAttribute("KeyPath", "yes");
EndElement("RegistryValue");
EndElement("Component");
}
void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
cmCPackComponentGroup const& group)
{
BeginElement("Feature");
AddAttribute("Id", "CM_G_" + group.Name);
if(group.IsExpandedByDefault)
{
AddAttribute("Display", "expand");
}
AddAttributeUnlessEmpty("Title", group.DisplayName);
AddAttributeUnlessEmpty("Description", group.Description);
for(std::vector<cmCPackComponentGroup*>::const_iterator
i = group.Subgroups.begin(); i != group.Subgroups.end(); ++i)
{
EmitFeatureForComponentGroup(**i);
}
for(std::vector<cmCPackComponent*>::const_iterator
i = group.Components.begin(); i != group.Components.end(); ++i)
{
EmitFeatureForComponent(**i);
}
EndElement("Feature");
}
void cmWIXFeaturesSourceWriter::EmitFeatureForComponent(
cmCPackComponent const& component)
{
BeginElement("Feature");
AddAttribute("Id", "CM_C_" + component.Name);
AddAttributeUnlessEmpty("Title", component.DisplayName);
AddAttributeUnlessEmpty("Description", component.Description);
if(component.IsRequired)
{
AddAttribute("Absent", "disallow");
}
if(component.IsHidden)
{
AddAttribute("Display", "hidden");
}
EndElement("Feature");
}
void cmWIXFeaturesSourceWriter::EmitComponentRef(std::string const& id)
{
BeginElement("ComponentRef");
AddAttribute("Id", id);
EndElement("ComponentRef");
}

View File

@ -0,0 +1,39 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmWIXFeaturesSourceWriter_h
#define cmWIXFeaturesSourceWriter_h
#include "cmWIXSourceWriter.h"
#include <CPack/cmCPackGenerator.h>
/** \class cmWIXFeaturesSourceWriter
* \brief Helper class to generate features.wxs
*/
class cmWIXFeaturesSourceWriter : public cmWIXSourceWriter
{
public:
cmWIXFeaturesSourceWriter(cmCPackLog* logger,
std::string const& filename);
void CreateCMakePackageRegistryEntry(
std::string const& package,
std::string const& upgradeGuid);
void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group);
void EmitFeatureForComponent(const cmCPackComponent& component);
void EmitComponentRef(std::string const& id);
};
#endif

View File

@ -0,0 +1,171 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmWIXFilesSourceWriter.h"
#include <sys/types.h>
#include <sys/stat.h>
cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger,
std::string const& filename):
cmWIXSourceWriter(logger, filename)
{
}
void cmWIXFilesSourceWriter::EmitShortcut(
std::string const& id,
cmWIXShortcut const& shortcut,
bool desktop)
{
std::string shortcutId;
if(desktop)
{
shortcutId = "CM_DS";
}
else
{
shortcutId = "CM_S";
}
shortcutId += id;
std::string fileId = std::string("CM_F") + id;
BeginElement("Shortcut");
AddAttribute("Id", shortcutId);
AddAttribute("Name", shortcut.textLabel);
std::string target = "[#" + fileId + "]";
AddAttribute("Target", target);
AddAttribute("WorkingDirectory", shortcut.workingDirectoryId);
EndElement("Shortcut");
}
void cmWIXFilesSourceWriter::EmitRemoveFolder(std::string const& id)
{
BeginElement("RemoveFolder");
AddAttribute("Id", id);
AddAttribute("On", "uninstall");
EndElement("RemoveFolder");
}
void cmWIXFilesSourceWriter::EmitStartMenuShortcutRegistryValue(
std::string const& registryKey,
std::string const& cpackComponentName)
{
EmitInstallRegistryValue(registryKey, cpackComponentName, std::string());
}
void cmWIXFilesSourceWriter::EmitDesktopShortcutRegistryValue(
std::string const& registryKey,
std::string const& cpackComponentName)
{
EmitInstallRegistryValue(registryKey, cpackComponentName, "_desktop");
}
void cmWIXFilesSourceWriter::EmitInstallRegistryValue(
std::string const& registryKey,
std::string const& cpackComponentName,
std::string const& suffix)
{
std::string valueName;
if(!cpackComponentName.empty())
{
valueName = cpackComponentName + "_";
}
valueName += "installed";
valueName += suffix;
BeginElement("RegistryValue");
AddAttribute("Root", "HKCU");
AddAttribute("Key", registryKey);
AddAttribute("Name", valueName);
AddAttribute("Type", "integer");
AddAttribute("Value", "1");
AddAttribute("KeyPath", "yes");
EndElement("RegistryValue");
}
void cmWIXFilesSourceWriter::EmitUninstallShortcut(
std::string const& packageName)
{
BeginElement("Shortcut");
AddAttribute("Id", "UNINSTALL");
AddAttribute("Name", "Uninstall " + packageName);
AddAttribute("Description", "Uninstalls " + packageName);
AddAttribute("Target", "[SystemFolder]msiexec.exe");
AddAttribute("Arguments", "/x [ProductCode]");
EndElement("Shortcut");
}
std::string cmWIXFilesSourceWriter::EmitComponentCreateFolder(
std::string const& directoryId, std::string const& guid)
{
std::string componentId =
std::string("CM_C_EMPTY_") + directoryId;
BeginElement("DirectoryRef");
AddAttribute("Id", directoryId);
BeginElement("Component");
AddAttribute("Id", componentId);
AddAttribute("Guid", guid);
BeginElement("CreateFolder");
EndElement("CreateFolder");
EndElement("Component");
EndElement("DirectoryRef");
return componentId;
}
std::string cmWIXFilesSourceWriter::EmitComponentFile(
std::string const& directoryId,
std::string const& id,
std::string const& filePath,
cmWIXPatch &patch)
{
std::string componentId = std::string("CM_C") + id;
std::string fileId = std::string("CM_F") + id;
BeginElement("DirectoryRef");
AddAttribute("Id", directoryId);
BeginElement("Component");
AddAttribute("Id", componentId);
AddAttribute("Guid", "*");
BeginElement("File");
AddAttribute("Id", fileId);
AddAttribute("Source", filePath);
AddAttribute("KeyPath", "yes");
mode_t fileMode = 0;
cmSystemTools::GetPermissions(filePath.c_str(), fileMode);
if(!(fileMode & S_IWRITE))
{
AddAttribute("ReadOnly", "yes");
}
patch.ApplyFragment(fileId, *this);
EndElement("File");
patch.ApplyFragment(componentId, *this);
EndElement("Component");
EndElement("DirectoryRef");
return componentId;
}

View File

@ -0,0 +1,66 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmWIXFilesSourceWriter_h
#define cmWIXFilesSourceWriter_h
#include "cmWIXSourceWriter.h"
#include "cmWIXShortcut.h"
#include "cmWIXPatch.h"
#include <CPack/cmCPackGenerator.h>
/** \class cmWIXFilesSourceWriter
* \brief Helper class to generate files.wxs
*/
class cmWIXFilesSourceWriter : public cmWIXSourceWriter
{
public:
cmWIXFilesSourceWriter(cmCPackLog* logger,
std::string const& filename);
void EmitShortcut(
std::string const& id,
cmWIXShortcut const& shortcut,
bool desktop);
void EmitRemoveFolder(std::string const& id);
void EmitStartMenuShortcutRegistryValue(
std::string const& registryKey,
std::string const& cpackComponentName);
void EmitDesktopShortcutRegistryValue(
std::string const& registryKey,
std::string const& cpackComponentName);
void EmitUninstallShortcut(std::string const& packageName);
std::string EmitComponentCreateFolder(
std::string const& directoryId,
std::string const& guid);
std::string EmitComponentFile(
std::string const& directoryId,
std::string const& id,
std::string const& filePath,
cmWIXPatch &patch);
private:
void EmitInstallRegistryValue(
std::string const& registryKey,
std::string const& cpackComponentName,
std::string const& suffix);
};
#endif

View File

@ -0,0 +1,91 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#include "cmWIXPatch.h"
#include <CPack/cmCPackGenerator.h>
cmWIXPatch::cmWIXPatch(cmCPackLog* logger):
Logger(logger)
{
}
void cmWIXPatch::LoadFragments(std::string const& patchFilePath)
{
cmWIXPatchParser parser(Fragments, Logger);
parser.ParseFile(patchFilePath.c_str());
}
void cmWIXPatch::ApplyFragment(
std::string const& id, cmWIXSourceWriter& writer)
{
cmWIXPatchParser::fragment_map_t::iterator i = Fragments.find(id);
if(i == Fragments.end()) return;
const cmWIXPatchElement& fragment = i->second;
for(cmWIXPatchElement::child_list_t::const_iterator
j = fragment.children.begin(); j != fragment.children.end(); ++j)
{
ApplyElement(**j, writer);
}
Fragments.erase(i);
}
void cmWIXPatch::ApplyElement(
const cmWIXPatchElement& element, cmWIXSourceWriter& writer)
{
writer.BeginElement(element.name);
for(cmWIXPatchElement::attributes_t::const_iterator
i = element.attributes.begin(); i != element.attributes.end(); ++i)
{
writer.AddAttribute(i->first, i->second);
}
for(cmWIXPatchElement::child_list_t::const_iterator
i = element.children.begin(); i != element.children.end(); ++i)
{
ApplyElement(**i, writer);
}
writer.EndElement(element.name);
}
bool cmWIXPatch::CheckForUnappliedFragments()
{
std::string fragmentList;
for(cmWIXPatchParser::fragment_map_t::const_iterator
i = Fragments.begin(); i != Fragments.end(); ++i)
{
if(!fragmentList.empty())
{
fragmentList += ", ";
}
fragmentList += "'";
fragmentList += i->first;
fragmentList += "'";
}
if(fragmentList.size())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Some XML patch fragments did not have matching IDs: " <<
fragmentList << std::endl);
return false;
}
return true;
}

View File

@ -0,0 +1,45 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmWIXPatch_h
#define cmWIXPatch_h
#include "cmWIXSourceWriter.h"
#include "cmWIXPatchParser.h"
#include <string>
/** \class cmWIXPatch
* \brief Class that maintains and applies patch fragments
*/
class cmWIXPatch
{
public:
cmWIXPatch(cmCPackLog* logger);
void LoadFragments(std::string const& patchFilePath);
void ApplyFragment(std::string const& id, cmWIXSourceWriter& writer);
bool CheckForUnappliedFragments();
private:
void ApplyElement(const cmWIXPatchElement& element,
cmWIXSourceWriter& writer);
cmCPackLog* Logger;
cmWIXPatchParser::fragment_map_t Fragments;
};
#endif

View File

@ -34,12 +34,11 @@ cmWIXPatchParser::cmWIXPatchParser(
} }
void cmWIXPatchParser::StartElement(const char *name, const char **atts) void cmWIXPatchParser::StartElement(const std::string& name, const char **atts)
{ {
std::string name_str = name;
if(State == BEGIN_DOCUMENT) if(State == BEGIN_DOCUMENT)
{ {
if(name_str == "CPackWiXPatch") if(name == "CPackWiXPatch")
{ {
State = BEGIN_FRAGMENTS; State = BEGIN_FRAGMENTS;
} }
@ -50,7 +49,7 @@ void cmWIXPatchParser::StartElement(const char *name, const char **atts)
} }
else if(State == BEGIN_FRAGMENTS) else if(State == BEGIN_FRAGMENTS)
{ {
if(name_str == "CPackWiXFragment") if(name == "CPackWiXFragment")
{ {
State = INSIDE_FRAGMENT; State = INSIDE_FRAGMENT;
StartFragment(atts); StartFragment(atts);
@ -107,12 +106,11 @@ void cmWIXPatchParser::StartFragment(const char **attributes)
} }
} }
void cmWIXPatchParser::EndElement(const char *name) void cmWIXPatchParser::EndElement(const std::string& name)
{ {
std::string name_str = name;
if(State == INSIDE_FRAGMENT) if(State == INSIDE_FRAGMENT)
{ {
if(name_str == "CPackWiXFragment") if(name == "CPackWiXFragment")
{ {
State = BEGIN_FRAGMENTS; State = BEGIN_FRAGMENTS;
ElementStack.clear(); ElementStack.clear();
@ -132,7 +130,7 @@ void cmWIXPatchParser::ReportError(int line, int column, const char* msg)
Valid = false; Valid = false;
} }
void cmWIXPatchParser::ReportValidationError(const std::string& message) void cmWIXPatchParser::ReportValidationError(std::string const& message)
{ {
ReportError(XML_GetCurrentLineNumber(Parser), ReportError(XML_GetCurrentLineNumber(Parser),
XML_GetCurrentColumnNumber(Parser), XML_GetCurrentColumnNumber(Parser),

View File

@ -43,14 +43,14 @@ public:
cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger); cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger);
private: private:
virtual void StartElement(const char *name, const char **atts); virtual void StartElement(const std::string& name, const char **atts);
void StartFragment(const char **attributes); void StartFragment(const char **attributes);
virtual void EndElement(const char *name); virtual void EndElement(const std::string& name);
virtual void ReportError(int line, int column, const char* msg); virtual void ReportError(int line, int column, const char* msg);
void ReportValidationError(const std::string& message); void ReportValidationError(std::string const& message);
bool IsValid() const; bool IsValid() const;

View File

@ -15,7 +15,7 @@
#include <cmVersion.h> #include <cmVersion.h>
cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter( cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter(
const std::string& filename): std::string const& filename):
File(filename.c_str(), std::ios::binary) File(filename.c_str(), std::ios::binary)
{ {
StartGroup(); StartGroup();
@ -33,7 +33,7 @@ cmWIXRichTextFormatWriter::~cmWIXRichTextFormatWriter()
File.put(0); File.put(0);
} }
void cmWIXRichTextFormatWriter::AddText(const std::string& text) void cmWIXRichTextFormatWriter::AddText(std::string const& text)
{ {
typedef unsigned char rtf_byte_t; typedef unsigned char rtf_byte_t;
@ -167,12 +167,12 @@ void cmWIXRichTextFormatWriter::WriteDocumentPrefix()
ControlWord("fs20"); ControlWord("fs20");
} }
void cmWIXRichTextFormatWriter::ControlWord(const std::string& keyword) void cmWIXRichTextFormatWriter::ControlWord(std::string const& keyword)
{ {
File << "\\" << keyword; File << "\\" << keyword;
} }
void cmWIXRichTextFormatWriter::NewControlWord(const std::string& keyword) void cmWIXRichTextFormatWriter::NewControlWord(std::string const& keyword)
{ {
File << "\\*\\" << keyword; File << "\\*\\" << keyword;
} }

View File

@ -22,10 +22,10 @@
class cmWIXRichTextFormatWriter class cmWIXRichTextFormatWriter
{ {
public: public:
cmWIXRichTextFormatWriter(const std::string& filename); cmWIXRichTextFormatWriter(std::string const& filename);
~cmWIXRichTextFormatWriter(); ~cmWIXRichTextFormatWriter();
void AddText(const std::string& text); void AddText(std::string const& text);
private: private:
void WriteHeader(); void WriteHeader();
@ -35,8 +35,8 @@ private:
void WriteDocumentPrefix(); void WriteDocumentPrefix();
void ControlWord(const std::string& keyword); void ControlWord(std::string const& keyword);
void NewControlWord(const std::string& keyword); void NewControlWord(std::string const& keyword);
void StartGroup(); void StartGroup();
void EndGroup(); void EndGroup();

View File

@ -0,0 +1,29 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2014 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmWIXFilesShortcut_h
#define cmWIXFilesShortcut_h
#include <string>
struct cmWIXShortcut
{
cmWIXShortcut()
:desktop(false)
{}
std::string textLabel;
std::string workingDirectoryId;
bool desktop;
};
#endif

Some files were not shown because too many files have changed in this diff Show More