diff options
99 files changed, 1359 insertions, 745 deletions
diff --git a/Docs/cmake-help.vim b/Docs/cmake-help.vim new file mode 100644 index 0000000..17cfa83 --- /dev/null +++ b/Docs/cmake-help.vim @@ -0,0 +1,21 @@ +nmap ,hc :call OpenCmakeHelp()<CR> + +function! OpenCmakeHelp() + let s = getline( '.' ) + let i = col( '.' ) - 1 + while i > 0 && strpart( s, i, 1 ) =~ '[A-Za-z0-9_]' + let i = i - 1 + endwhile + while i < col('$') && strpart( s, i, 1 ) !~ '[A-Za-z0-9_]' + let i = i + 1 + endwhile + let start = match( s, '[A-Za-z0-9_]\+', i ) + let end = matchend( s, '[A-Za-z0-9_]\+', i ) + let ident = strpart( s, start, end - start ) + execute "vertical new" + execute "%!cmake --help-command ".ident + set nomodified + set readonly +endfunction + +autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in nmap <F1> :call OpenCmakeHelp()<CR> diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 48830cb..44f2c20 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -27,6 +27,11 @@ # drag-n-drop copied to another machine and run on that machine as long as all # of the system libraries are compatible. # +# If you pass plugins to fixup_bundle as the libs parameter, you should install +# them or copy them into the bundle before calling fixup_bundle. The "libs" +# parameter is a list of libraries that must be fixed up, but that cannot be +# determined by otool output analysis. (i.e., plugins) +# # Gather all the keys for all the executables and libraries in a bundle, and # then, for each key, copy each prerequisite into the bundle. Then fix each one # up according to its own list of prerequisites. @@ -112,6 +117,13 @@ # _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to # an "@executable_path" style reference.) # +# This function requires that the resolved_embedded_item be "inside" the bundle +# already. In other words, if you pass plugins to fixup_bundle as the libs +# parameter, you should install them or copy them into the bundle before +# calling fixup_bundle. The "libs" parameter is a list of libraries that must +# be fixed up, but that cannot be determined by otool output analysis. (i.e., +# plugins) +# # Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM # value. # @@ -527,6 +539,24 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) # get_item_key("${resolved_embedded_item}" ikey) + # Ensure the item is "inside the .app bundle" -- it should not be fixed up if + # it is not in the .app bundle... Otherwise, we'll modify files in the build + # tree, or in other varied locations around the file system, with our call to + # install_name_tool. Make sure that doesn't happen here: + # + get_dotapp_dir("${exepath}" exe_dotapp_dir) + string(LENGTH "${exe_dotapp_dir}/" exe_dotapp_dir_length) + string(SUBSTRING "${resolved_embedded_item}" 0 ${exe_dotapp_dir_length} item_substring) + if(NOT "${exe_dotapp_dir}/" STREQUAL "${item_substring}") + message(" exe_dotapp_dir/='${exe_dotapp_dir}/'") + message(" item_substring='${item_substring}'") + message(" resolved_embedded_item='${resolved_embedded_item}'") + message("") + message("Install or copy the item into the bundle before calling fixup_bundle") + message("") + message(FATAL_ERROR "cannot fixup an item that is not in the bundle...") + endif() + set(prereqs "") get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}") diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index d6df305..ed0b6fb 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -64,7 +64,8 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src) AND NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" # Skip this with Xcode for now. AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode) - CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log) + CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log + "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Parsed ${lang} implicit link information from above output:\n${log}\n\n") ENDIF() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 03ddd78..5355886 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -169,6 +169,9 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN) LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran") + LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS NAG) # Numerical Algorithms Group + SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V") + SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler") # Try to identify the compiler. SET(CMAKE_Fortran_COMPILER_ID) @@ -215,6 +218,10 @@ ENDIF(NOT CMAKE_Fortran_COMPILER_ID_RUN) INCLUDE(CMakeFindBinUtils) +IF(MSVC_Fortran_ARCHITECTURE_ID) + SET(SET_MSVC_Fortran_ARCHITECTURE_ID + "SET(MSVC_Fortran_ARCHITECTURE_ID ${MSVC_Fortran_ARCHITECTURE_ID})") +ENDIF() # configure variables set in this file for fast reload later on CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index 836e4c9..fbcdc98 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -17,6 +17,12 @@ FIND_PROGRAM(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable") +# This variable is used by the Eclipse generator and appended to the make invocation commands. +SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds") + +# This variable is used by the Eclipse generator in out-of-source builds only. +SET(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR") +MARK_AS_ADVANCED(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT) # The Eclipse generator needs to know the standard include path # so that Eclipse ca find the headers at runtime and parsing etc. works better diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 5558651..146a6f2 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,7 @@ SET(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") SET(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") SET(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") SET(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") +@SET_MSVC_Fortran_ARCHITECTURE_ID@ SET(CMAKE_AR "@CMAKE_AR@") SET(CMAKE_RANLIB "@CMAKE_RANLIB@") SET(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 4080cc1..8584731 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -109,4 +109,13 @@ # endif PRINT *, 'INFO:platform[]' #endif +#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC)) +# if defined(_M_IA64) + PRINT *, 'INFO:arch[IA64]' +# elif defined(_M_X64) || defined(_M_AMD64) + PRINT *, 'INFO:arch[x64]' +# elif defined(_M_IX86) + PRINT *, 'INFO:arch[X86]' +# endif +#endif END diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index f6a52c6..1e9b4e0 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -67,29 +67,29 @@ SET(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1) # Create a set of shared library variable specific to Fortran # For 90% of the systems, these are the same flags as the C versions # so if these are not set just copy the flags from the c version -IF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) +ENDIF() IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) +ENDIF() IF(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG) SET(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) @@ -100,25 +100,25 @@ IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG) ENDIF() # repeat for modules -IF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_MODULE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) +IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) +IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) +IF(NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) SET(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) +ENDIF() IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH) SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index defdb47..5405bda 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -16,7 +16,7 @@ # This is used internally by CMake and should not be included by user # code. -function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var) +function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex) set(implicit_libs_tmp "") set(implicit_dirs_tmp) set(log "") @@ -59,6 +59,11 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var) # Unix library full path. list(APPEND implicit_libs_tmp ${arg}) set(log "${log} arg [${arg}] ==> lib [${arg}]\n") + elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$" + AND obj_regex AND "${arg}" MATCHES "${obj_regex}") + # Object file full path. + list(APPEND implicit_libs_tmp ${arg}) + set(log "${log} arg [${arg}] ==> obj [${arg}]\n") elseif("${arg}" MATCHES "^-Y(P,)?") # Sun search path. string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}") diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in index 3b50e74..dee576f 100755 --- a/Modules/CPack.STGZ_Header.sh.in +++ b/Modules/CPack.STGZ_Header.sh.in @@ -80,7 +80,7 @@ then if [ "x${cpack_skip_license}x" != "xTRUEx" ] then - more << ____cpack__here_doc____ + more << '____cpack__here_doc____' @CPACK_RESOURCE_FILE_LICENSE_CONTENT@ ____cpack__here_doc____ echo diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index ab909f4..026c45a 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -566,10 +566,9 @@ mv $RPM_BUILD_ROOT \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" %install if [ -e $RPM_BUILD_ROOT ]; then - mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/*\" $RPM_BUILD_ROOT -else - mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT + rm -rf $RPM_BUILD_ROOT fi +mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %clean diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index cf519b1..a03b64d 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -25,7 +25,7 @@ INCLUDE(CheckCSourceCompiles) MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") - CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT} + CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} # Some compilers do not fail with a bad flag FAIL_REGEX "unrecognized .*option" # GNU FAIL_REGEX "ignoring unknown option" # MSVC diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake new file mode 100644 index 0000000..b68c479 --- /dev/null +++ b/Modules/Compiler/NAG-Fortran.cmake @@ -0,0 +1,32 @@ +# Help CMAKE_PARSE_IMPLICIT_LINK_INFO detect NAG Fortran object files. +if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED) + message(STATUS "Detecting NAG Fortran directory") + # Run with -dryrun to see sample "link" line. + execute_process( + COMMAND ${CMAKE_Fortran_COMPILER} dummy.o -dryrun + OUTPUT_VARIABLE _dryrun + ERROR_VARIABLE _dryrun + ) + # Match an object file. + string(REGEX MATCH "/[^ ]*/[^ /][^ /]*\\.o" _nag_obj "${_dryrun}") + if(_nag_obj) + # Parse object directory and convert to a regex. + string(REGEX REPLACE "/[^/]*$" "" _nag_dir "${_nag_obj}") + string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _nag_regex "${_nag_dir}") + set(CMAKE_Fortran_IMPLICIT_OBJECT_REGEX "^${_nag_regex}/") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Detecting NAG Fortran directory with -dryrun found\n" + " object: ${_nag_obj}\n" + " directory: ${_nag_dir}\n" + " regex: ${CMAKE_Fortran_IMPLICIT_OBJECT_REGEX}\n" + "from output:\n${_dryrun}\n\n") + message(STATUS "Detecting NAG Fortran directory - ${_nag_dir}") + else() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Detecting NAG Fortran directory with -dryrun failed:\n${_dryrun}\n\n") + message(STATUS "Detecting NAG Fortran directory - failed") + endif() +endif() + +set(CMAKE_Fortran_MODDIR_FLAG "-mdir ") +set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 1be6cfd..a3590cf 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -32,6 +32,7 @@ # [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable # [CMAKE_GENERATOR gen] # Specify generator for native build # [CMAKE_ARGS args...] # Arguments to CMake command line +# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on # #--Build step----------------- # [BINARY_DIR dir] # Specify build dir location # [BUILD_COMMAND cmd...] # Command to drive the native build @@ -549,6 +550,47 @@ function(_ep_set_directories name) endforeach() endfunction(_ep_set_directories) +function(_ep_write_initial_cache script_filename args) + # Write out values into an initial cache, that will be passed to CMake with -C + set(script_initial_cache "") + set(regex "^([^:]+):([^=]+)=(.*)$") + set(setArg "") + foreach(line ${args}) + if("${line}" MATCHES "^-D") + if(setArg) + # This is required to build up lists in variables, or complete an entry + set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)") + set(script_initial_cache "${script_initial_cache}\n${setArg}") + set(accumulator "") + set(setArg "") + endif() + string(REGEX REPLACE "^-D" "" line ${line}) + if("${line}" MATCHES "${regex}") + string(REGEX MATCH "${regex}" match "${line}") + set(name "${CMAKE_MATCH_1}") + set(type "${CMAKE_MATCH_2}") + set(value "${CMAKE_MATCH_3}") + set(setArg "set(${name} \"${value}") + else() + message(WARNING "Line '${line}' does not match regex. Ignoring.") + endif() + else() + # Assume this is a list to append to the last var + set(accumulator "${accumulator};${line}") + endif() + endforeach() + # Catch the final line of the args + if(setArg) + set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)") + set(script_initial_cache "${script_initial_cache}\n${setArg}") + endif() + # Write out the initial cache file to the location specified. + if(NOT EXISTS "${script_filename}.in") + file(WRITE "${script_filename}.in" "\@script_initial_cache\@\n") + endif() + configure_file("${script_filename}.in" "${script_filename}") +endfunction(_ep_write_initial_cache) + function(ExternalProject_Get_Property name) foreach(var ${ARGN}) @@ -1224,6 +1266,14 @@ function(_ep_add_configure_command name) get_property(cmake_args TARGET ${name} PROPERTY _EP_CMAKE_ARGS) list(APPEND cmd ${cmake_args}) + # If there are any CMAKE_CACHE_ARGS, write an initial cache and use it + get_property(cmake_cache_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_ARGS) + if(cmake_cache_args) + set(_ep_cache_args_script "${tmp_dir}/${name}-cache.cmake") + _ep_write_initial_cache("${_ep_cache_args_script}" "${cmake_cache_args}") + list(APPEND cmd "-C${_ep_cache_args_script}") + endif() + get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) if(cmake_generator) list(APPEND cmd "-G${cmake_generator}" "${source_dir}") @@ -1242,10 +1292,11 @@ function(_ep_add_configure_command name) # Fixes issue http://public.kitware.com/Bug/view.php?id=10258 # if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in) - file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='@cmd@'\n") + file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='\@cmd\@'\n") endif() configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt) list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt) + list(APPEND file_deps ${_ep_cache_args_script}) get_property(log TARGET ${name} PROPERTY _EP_LOG_CONFIGURE) if(log) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 94bbed5..b605164 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -40,16 +40,7 @@ # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if(NOT _LANGUAGES_ MATCHES Fortran) - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR "FindBLAS is Fortran-only so Fortran must be enabled.") - else(BLAS_FIND_REQUIRED) - message(STATUS "Looking for BLAS... - NOT found (Fortran not enabled)") # - return() - endif(BLAS_FIND_REQUIRED) -endif(NOT _LANGUAGES_ MATCHES Fortran) - -include(CheckFortranFunctionExists) +include(CheckFunctionExists) macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads) # This macro checks for the existence of the combination of fortran libraries @@ -107,7 +98,7 @@ if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) @@ -246,13 +237,24 @@ endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") #BLAS in acml library? if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") + # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" - "acml" + "acml;acml_mv" + "" + ) + endif(NOT BLAS_LIBRARIES) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml_mp;acml_mv" "" ) endif(NOT BLAS_LIBRARIES) @@ -300,6 +302,9 @@ endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") #BLAS in intel mkl 10 library? (em64t 64bit) if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + if (NOT WIN32) + set(LM "-lm") + endif () if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads) @@ -340,7 +345,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS95_LIBRARIES) else(BLA_F95) @@ -352,6 +357,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "" "mkl_intel;mkl_intel_thread;mkl_core;guide" "${CMAKE_THREAD_LIBS_INIT}" + "${LM}" ) endif(NOT BLAS_LIBRARIES) endif(BLA_F95) @@ -365,7 +371,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS95_LIBRARIES) else(BLA_F95) @@ -376,7 +382,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) endif(BLA_F95) @@ -391,7 +397,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) #BLAS in intel mkl library? (static, 32bit) @@ -402,7 +408,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_ia32;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) #BLAS in intel mkl library? (static, em64t 64bit) @@ -413,7 +419,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_em64t;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 28296f1..8930405 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -64,7 +64,8 @@ # Currently this module searches for the following version numbers: # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, -# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0 +# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0, +# 1.45, 1.45.0, 1.46, 1.46.0 # # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should # add both 1.x and 1.x.0 as shown above. Official Boost include directories @@ -377,7 +378,7 @@ else(Boost_FIND_VERSION_EXACT) # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" + "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33") @@ -412,9 +413,7 @@ IF(Boost_INCLUDE_DIR) # On versions < 1.35, remove the System library from the considered list # since it wasn't added until 1.35. if(Boost_VERSION AND Boost_FIND_COMPONENTS) - math(EXPR _boost_maj "${Boost_VERSION} / 100000") - math(EXPR _boost_min "${Boost_VERSION} / 100 % 1000") - if(${_boost_maj}.${_boost_min} VERSION_LESS 1.35) + if(Boost_VERSION LESS 103500) list(REMOVE_ITEM Boost_FIND_COMPONENTS system) endif() endif() @@ -477,16 +476,16 @@ ELSE (_boost_IN_CACHE) # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be # linked dynamically. Alternatively you can force all Boost # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. - + # This feature can be disabled for Boost library "whatever" by # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining # BOOST_ALL_NO_LIB. - + # If you want to observe which libraries are being linked against # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking # code to emit a #pragma message each time a library is selected # for linking. - SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS + SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") ENDIF(WIN32) @@ -519,12 +518,12 @@ ELSE (_boost_IN_CACHE) IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - + # If BOOST_LIBRARYDIR was defined in the environment, use it. IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - + IF( BOOST_ROOT ) file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) ENDIF( BOOST_ROOT ) @@ -563,7 +562,7 @@ ELSE (_boost_IN_CACHE) endif( BOOST_INCLUDEDIR ) # ------------------------------------------------------------------------ - # Search for Boost include DIR + # Search for Boost include DIR # ------------------------------------------------------------------------ # Try to find Boost by stepping backwards through the Boost versions # we know about. @@ -578,18 +577,18 @@ ELSE (_boost_IN_CACHE) # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" + STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" _boost_BOOSTIFIED_VERSION ${_boost_VER}) ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" + STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" _boost_BOOSTIFIED_VERSION ${_boost_VER}) ENDIF() - + list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") ENDFOREACH(_boost_VER) - + if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "Include debugging info:") @@ -607,7 +606,7 @@ ELSE (_boost_IN_CACHE) ${_boost_FIND_OPTIONS} ) ENDIF( NOT Boost_INCLUDE_DIR ) - + # ------------------------------------------------------------------------ # Extract version information from version.hpp # ------------------------------------------------------------------------ @@ -623,13 +622,13 @@ ELSE (_boost_IN_CACHE) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") endif() - + STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") - + SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") - + IF(NOT "${Boost_VERSION}" STREQUAL "0") MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") @@ -647,7 +646,7 @@ ELSE (_boost_IN_CACHE) set(Boost_ERROR_REASON "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") ENDIF(Boost_INCLUDE_DIR) - + # ------------------------------------------------------------------------ # Suffix initialization and compiler suffix detection. # ------------------------------------------------------------------------ @@ -670,7 +669,7 @@ ELSE (_boost_IN_CACHE) # please report them and use the Boost_COMPILER variable # to work around the problems. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") if(WIN32) set (_boost_COMPILER "-iw") @@ -999,7 +998,7 @@ ELSE (_boost_IN_CACHE) if (NOT Boost_FIND_VERSION_PATCH) set(Boost_FIND_VERSION_PATCH 0) endif (NOT Boost_FIND_VERSION_PATCH) - + # We'll set Boost_FOUND true again if we have an exact version match. set(Boost_FOUND FALSE) _Boost_MARK_COMPONENTS_FOUND(OFF) @@ -1018,7 +1017,7 @@ ELSE (_boost_IN_CACHE) set(Boost_ERROR_REASON "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") if (Boost_FIND_VERSION_PATCH) - set(Boost_ERROR_REASON + set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") endif (Boost_FIND_VERSION_PATCH) if (NOT Boost_FIND_VERSION_EXACT) @@ -1073,16 +1072,16 @@ ELSE (_boost_IN_CACHE) # Note that the user may not have installed any libraries # so it is quite possible the Boost_LIBRARY_PATH may not exist. SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) - + IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - + IF("${_boost_LIB_DIR}" MATCHES "/include$") # Strip off the trailing "/include" in the path. GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) ENDIF("${_boost_LIB_DIR}" MATCHES "/include$") - + IF(EXISTS "${_boost_LIB_DIR}/lib") SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib) ELSE(EXISTS "${_boost_LIB_DIR}/lib") @@ -1092,7 +1091,7 @@ ELSE (_boost_IN_CACHE) SET(_boost_LIB_DIR "") ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib") ENDIF(EXISTS "${_boost_LIB_DIR}/lib") - + IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") @@ -1143,4 +1142,3 @@ ELSE (_boost_IN_CACHE) Boost_LIBRARY_DIRS ) ENDIF(_boost_IN_CACHE) - diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index 272cdc7..ff6b085 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -36,8 +36,8 @@ # find_package(BISON) # find_package(FLEX) # -# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp -# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BIANRY_DIR}/lexer.cpp) +# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) +# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp) # ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser) # # include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index 8d780c1..8cfd9ca 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -104,7 +104,7 @@ ENDIF(WIN32) FIND_LIBRARY(TCL_LIBRARY NAMES tcl - tcl${TK_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION} + tcl${TCL_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION} tcl86 tcl8.6 tcl85 tcl8.5 tcl84 tcl8.4 @@ -117,7 +117,7 @@ FIND_LIBRARY(TCL_LIBRARY FIND_LIBRARY(TK_LIBRARY NAMES tk - tk${TCL_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION} + tk${TK_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION} tk86 tk8.6 tk85 tk8.5 tk84 tk8.4 diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index 18014af..4bcaae9 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -45,10 +45,12 @@ set(module_symbols my_module_mp_my_sub_ # Intel MY_MODULE_mp_MY_SUB # Intel on Windows my_module_my_sub_ # PGI + my_module_MP_my_sub # NAG mymodule$mysub # HP mymodule_mp_mysub_ # Intel MYMODULE_mp_MYSUB # Intel on Windows mymodule_mysub_ # PGI + mymodule_MP_mysub # NAG ${FortranCInterface_MODULE_SYMBOLS} ) list(REMOVE_DUPLICATES module_symbols) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index b157f72..1576982 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -3,7 +3,7 @@ SET(CYGWIN 1) SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") -SET(CMAKE_SHARED_MODULE_PREFIX "lib") +SET(CMAKE_SHARED_MODULE_PREFIX "cyg") SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake new file mode 100644 index 0000000..933f9e1 --- /dev/null +++ b/Modules/Platform/Darwin-NAG-Fortran.cmake @@ -0,0 +1,5 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need -fpp explicitly on case-insensitive filesystem. +set(CMAKE_Fortran_COMPILE_OBJECT + "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>") diff --git a/Modules/Platform/Linux-NAG-Fortran.cmake b/Modules/Platform/Linux-NAG-Fortran.cmake new file mode 100644 index 0000000..353bae6 --- /dev/null +++ b/Modules/Platform/Linux-NAG-Fortran.cmake @@ -0,0 +1,10 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need one "-Wl," level to send flag through to gcc. +# Use "-Xlinker" to get through gcc to real linker. +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-Xlinker,-rpath,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-Xlinker,-rpath-link,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-Xlinker,-soname,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-rdynamic") diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake new file mode 100644 index 0000000..767fec5 --- /dev/null +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Intel) +__windows_compiler_intel(C) diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake new file mode 100644 index 0000000..2845b0f --- /dev/null +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -0,0 +1,4 @@ +include(Platform/Windows-Intel) +set(_COMPILE_CXX " /TP") +set(_FLAGS_CXX " /GX /GR") +__windows_compiler_intel(CXX) diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake new file mode 100644 index 0000000..c959287 --- /dev/null +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -0,0 +1,11 @@ +include(Platform/Windows-Intel) +set(CMAKE_BUILD_TYPE_INIT Debug) +set(_COMPILE_Fortran " /fpp") +set(CMAKE_Fortran_MODDIR_FLAG "-module:") +set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") +__windows_compiler_intel(Fortran) +SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") +SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") +SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG") diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index e893925..444a60e 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -1,3 +1,62 @@ + +#============================================================================= +# Copyright 2002-2010 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_INTEL) + return() +endif() +set(__WINDOWS_INTEL 1) + +SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +SET(CMAKE_LINK_LIBRARY_FLAG "") +SET(WIN32 1) +IF(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO) +ELSE(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO "/nologo") +ENDIF(CMAKE_VERBOSE_MAKEFILE) +SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") +SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) +SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) + +# default to Debug builds +#SET(CMAKE_BUILD_TYPE_INIT Debug) +SET(CMAKE_BUILD_TYPE_INIT Release) + +SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +IF(MSVC_C_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") +ELSEIF(MSVC_CXX_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") +ELSEIF(MSVC_Fortran_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") +ENDIF() +SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") + +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + INCLUDE("${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake" OPTIONAL) IF(NOT _INTEL_XILINK_TEST_RUN) @@ -15,3 +74,31 @@ SET(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) ") ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") ENDIF(NOT _INTEL_XILINK_TEST_RUN) + +macro(__windows_compiler_intel lang) + set(CMAKE_${lang}_COMPILE_OBJECT + "<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <DEFINES> <FLAGS> -E <SOURCE>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + set(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /GZ") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") + + if(_INTEL_COMPILER_SUPPORTS_MANIFEST) + SET(CMAKE_${lang}_LINK_EXECUTABLE + "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") + SET(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + SET(CMAKE_${lang}_CREATE_SHARED_MODULE + "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") + endif() +endmacro() diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 7463c62..56582ff 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -212,6 +212,8 @@ SET (CMAKE_EXE_LINKER_FLAGS_INIT SET( MSVC_INCREMENTAL_YES_FLAG "") IF(NOT MSVC_INCREMENTAL_DEFAULT) SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") +ELSE() + SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) ENDIF() IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) diff --git a/Modules/Platform/Windows-g++.cmake b/Modules/Platform/Windows-g++.cmake deleted file mode 100644 index 3aa393c..0000000 --- a/Modules/Platform/Windows-g++.cmake +++ /dev/null @@ -1 +0,0 @@ -INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-gcc.cmake) diff --git a/Modules/Platform/Windows-icl.cmake b/Modules/Platform/Windows-icl.cmake deleted file mode 100644 index 9088cc7..0000000 --- a/Modules/Platform/Windows-icl.cmake +++ /dev/null @@ -1,109 +0,0 @@ -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(WIN32 1) -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) - -SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) -SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) - -# create a shared C++ library -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared library -SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared module just copy the shared library rule -SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY}) - - -# create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") - -# create a C static library -SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) - -# compile a C++ file into an object file -SET(CMAKE_CXX_COMPILE_OBJECT - "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -DWIN32 /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -SET(CMAKE_C_COMPILE_OBJECT - "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -DWIN32 /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") - - -SET(CMAKE_C_LINK_EXECUTABLE - "<CMAKE_C_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE - "<CMAKE_C_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - "<CMAKE_CXX_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP -E <SOURCE>${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") - -SET(CMAKE_CXX_LINK_EXECUTABLE - "<CMAKE_CXX_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> <OBJECTS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -# default to Debug builds -#SET(CMAKE_BUILD_TYPE_INIT Debug) -SET(CMAKE_BUILD_TYPE_INIT Release) -SET (CMAKE_CXX_FLAGS_INIT "/W3 /Zm1000 /GX /GR") -SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ") -SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1") -SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2") -SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2") -SET (CMAKE_C_FLAGS_INIT "/W3 /Zm1000") -SET (CMAKE_C_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ") -SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1") -SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2") - - -SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") -SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") - -# executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) -IF(NOT _MACHINE_ARCH_FLAG) - SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) -ENDIF(NOT _MACHINE_ARCH_FLAG) -SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES /machine:${_MACHINE_ARCH_FLAG}") -SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") -SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") - -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) - - -INCLUDE(Platform/Windows-Intel) - -IF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - SET(CMAKE_C_LINK_EXECUTABLE - "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") - SET(CMAKE_C_CREATE_SHARED_LIBRARY - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_C_CREATE_SHARED_LIBRARY}") - SET(CMAKE_C_CREATE_SHARED_MODULE - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_C_CREATE_SHARED_MODULE}") - SET(CMAKE_CXX_LINK_EXECUTABLE - "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") - SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - SET(CMAKE_CXX_CREATE_SHARED_MODULE - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") -ENDIF(_INTEL_COMPILER_SUPPORTS_MANIFEST) diff --git a/Modules/Platform/Windows-ifort.cmake b/Modules/Platform/Windows-ifort.cmake deleted file mode 100644 index 6cffed9..0000000 --- a/Modules/Platform/Windows-ifort.cmake +++ /dev/null @@ -1,80 +0,0 @@ -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(WIN32 1) -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) - -SET(CMAKE_Fortran_MODDIR_FLAG "-module:") - -SET(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1) - -SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - "link ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /dll <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) - -# create a C++ static library -SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") - -# compile a C++ file into an object file -SET(CMAKE_Fortran_COMPILE_OBJECT - "<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /fpp /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") - -SET(CMAKE_Fortran_LINK_EXECUTABLE - "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - -INCLUDE(Platform/Windows-Intel) - -IF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - SET(CMAKE_Fortran_LINK_EXECUTABLE - "<CMAKE_COMMAND> -E vs_link_exe ${CMAKE_Fortran_LINK_EXECUTABLE}") - SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}") - SET(CMAKE_Fortran_CREATE_SHARED_MODULE - "<CMAKE_COMMAND> -E vs_link_dll ${CMAKE_Fortran_CREATE_SHARED_MODULE}") -ENDIF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - -SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") - SET (CMAKE_NO_BUILD_TYPE 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") -IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") - SET (CMAKE_NO_BUILD_TYPE 1) - SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING - "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") -# does the compiler support pdbtype and is it the newer compiler - -SET(CMAKE_BUILD_TYPE_INIT Debug) -SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") -SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG") - -SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") - -# executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES") -IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") -ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") -ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index ded329d..46be99b 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -285,7 +285,7 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const { // The Component installation support should only // be activated if explicitly requested by the user // (for backward compatibility reason) - if (IsSet("CPACK_ARCHIVE_COMPONENT_INSTALL")) + if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL")) { return true; } diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 92e5b6a..feda52c 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -551,7 +551,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::vector<std::string> componentsVector; bool componentInstall = false; - if (this->SupportsComponentInstallation()) + /* + * We do a component install iff + * - the CPack generator support component + * - the user did not request Monolithic install + * (this works at CPack time too) + */ + if (this->SupportsComponentInstallation() & + !(this->IsSet("CPACK_MONOLITHIC_INSTALL"))) { // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" @@ -1063,7 +1070,13 @@ bool cmCPackGenerator::IsSet(const char* name) const } //---------------------------------------------------------------------- -const char* cmCPackGenerator::GetOption(const char* op) +bool cmCPackGenerator::IsOn(const char* name) const +{ + return cmSystemTools::IsOn(GetOption(name)); +} + +//---------------------------------------------------------------------- +const char* cmCPackGenerator::GetOption(const char* op) const { const char* ret = this->MakefileMap->GetDefinition(op); if(!ret) diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index c450763..f44a334 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -88,8 +88,9 @@ public: //! Set and get the options void SetOption(const char* op, const char* value); void SetOptionIfNotSet(const char* op, const char* value); - const char* GetOption(const char* op); + const char* GetOption(const char* op) const; bool IsSet(const char* name) const; + bool IsOn(const char* name) const; //! Set all the variables int SetCMakeRoot(); diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d0eda81..f25866c 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -337,6 +337,7 @@ int cmCPackNSISGenerator::InitializeInternal() << std::endl); std::vector<std::string> path; std::string nsisPath; + bool gotRegValue = true; #ifdef _WIN32 if ( !cmsys::SystemTools::ReadRegistryValue( @@ -346,24 +347,37 @@ int cmCPackNSISGenerator::InitializeInternal() if ( !cmsys::SystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) { - cmCPackLogger - (cmCPackLog::LOG_ERROR, - "Cannot find NSIS registry value. This is usually caused by NSIS " - "not being installed. Please install NSIS from " - "http://nsis.sourceforge.net" - << std::endl); - return 0; + gotRegValue = false; } } - path.push_back(nsisPath); + + if (gotRegValue) + { + path.push_back(nsisPath); + } #endif + nsisPath = cmSystemTools::FindProgram("makensis", path, false); + if ( nsisPath.empty() ) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find NSIS compiler" + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find NSIS compiler makensis: likely it is not installed, " + "or not in your PATH" << std::endl); + + if (!gotRegValue) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Could not read NSIS registry value. This is usually caused by " + "NSIS not being installed. Please install NSIS from " + "http://nsis.sourceforge.net" + << std::endl); + } + return 0; } + std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "VERSION"; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: " << nsisCmd.c_str() << std::endl); diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 34e93d3..a5db78f 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -108,7 +108,7 @@ int cmCPackRPMGenerator::PackageFiles() bool cmCPackRPMGenerator::SupportsComponentInstallation() const { - if (IsSet("CPACK_RPM_COMPONENT_INSTALL")) + if (IsOn("CPACK_RPM_COMPONENT_INSTALL")) { return true; } diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index a6f10ec..aa9e55b 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -503,28 +503,15 @@ private: this->ParsePerson(this->Line.c_str()+7, author); this->Rev.Author = author.Name; this->Rev.EMail = author.EMail; - - // Convert the time to a human-readable format that is also easy - // to machine-parse: "CCYY-MM-DD hh:mm:ss". - time_t seconds = static_cast<time_t>(author.Time); - struct tm* t = gmtime(&seconds); - char dt[1024]; - sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", - t->tm_year+1900, t->tm_mon+1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - this->Rev.Date = dt; - - // Add the time-zone field "+zone" or "-zone". - char tz[32]; - if(author.TimeZone >= 0) - { - sprintf(tz, " +%04ld", author.TimeZone); - } - else - { - sprintf(tz, " -%04ld", -author.TimeZone); - } - this->Rev.Date += tz; + this->Rev.Date = this->FormatDateTime(author); + } + else if(strncmp(this->Line.c_str(), "committer ", 10) == 0) + { + Person committer; + this->ParsePerson(this->Line.c_str()+10, committer); + this->Rev.Committer = committer.Name; + this->Rev.CommitterEMail = committer.EMail; + this->Rev.CommitDate = this->FormatDateTime(committer); } } @@ -537,6 +524,32 @@ private: } this->Rev.Log += "\n"; } + + std::string FormatDateTime(Person const& person) + { + // Convert the time to a human-readable format that is also easy + // to machine-parse: "CCYY-MM-DD hh:mm:ss". + time_t seconds = static_cast<time_t>(person.Time); + struct tm* t = gmtime(&seconds); + char dt[1024]; + sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", + t->tm_year+1900, t->tm_mon+1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + std::string out = dt; + + // Add the time-zone field "+zone" or "-zone". + char tz[32]; + if(person.TimeZone >= 0) + { + sprintf(tz, " +%04ld", person.TimeZone); + } + else + { + sprintf(tz, " -%04ld", -person.TimeZone); + } + out += tz; + return out; + } }; char const cmCTestGIT::CommitParser::SectionSep[SectionCount] = diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 93c2963..94614cf 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -653,32 +653,37 @@ bool cmCTestMultiProcessHandler::CheckCycles() it != this->Tests.end(); ++it) { //DFS from each element to itself + int root = it->first; + std::set<int> visited; std::stack<int> s; - std::vector<int> visited; - - s.push(it->first); - + s.push(root); while(!s.empty()) { int test = s.top(); s.pop(); - - for(TestSet::iterator d = this->Tests[test].begin(); - d != this->Tests[test].end(); ++d) + if(visited.insert(test).second) { - if(std::find(visited.begin(), visited.end(), *d) != visited.end()) + for(TestSet::iterator d = this->Tests[test].begin(); + d != this->Tests[test].end(); ++d) { - //cycle exists - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " - "the test dependency graph for the test \"" - << this->Properties[it->first]->Name << "\"." << std::endl - << "Please fix the cycle and run ctest again." << std::endl); - return false; + if(*d == root) + { + //cycle exists + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error: a cycle exists in the test dependency graph " + "for the test \"" << this->Properties[root]->Name << + "\".\nPlease fix the cycle and run ctest again.\n"); + return false; + } + else + { + s.push(*d); + } } - s.push(*d); } - visited.push_back(test); } } + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph end" << std::endl); return true; } diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 411eb01..468cd85 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -63,11 +63,10 @@ public: virtual const char* GetFullDocumentation() { return - " ctest_sleep( seconds )\n" - " ctest_sleep( time1 duration time2 )\n" - "With one argument it will sleep for a given number of seconds. " - "With three arguments it will wait for time2 - time1 - duration " - "seconds."; + " ctest_sleep(<seconds>)\n" + "Sleep for given number of seconds.\n" + " ctest_sleep(<time1> <duration> <time2>)\n" + "Sleep for t=(time1 + duration - time2) seconds if t > 0."; } cmTypeMacro(cmCTestSleepCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6dd348d..6eec3c8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -438,6 +438,8 @@ void cmCTestTestHandler::Initialize() this->TestsToRun.clear(); + this->UseIncludeLabelRegExpFlag = false; + this->UseExcludeLabelRegExpFlag = false; this->UseIncludeRegExpFlag = false; this->UseExcludeRegExpFlag = false; this->UseExcludeRegExpFirst = false; diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index f9ad79a..fbee227 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -228,6 +228,11 @@ void cmCTestVC::WriteXMLEntry(std::ostream& xml, << "\t\t\t<CheckinDate>" << cmXMLSafe(rev.Date) << "</CheckinDate>\n" << "\t\t\t<Author>" << cmXMLSafe(rev.Author) << "</Author>\n" << "\t\t\t<Email>" << cmXMLSafe(rev.EMail) << "</Email>\n" + << "\t\t\t<Committer>" << cmXMLSafe(rev.Committer) << "</Committer>\n" + << "\t\t\t<CommitterEmail>" << cmXMLSafe(rev.CommitterEMail) + << "</CommitterEmail>\n" + << "\t\t\t<CommitDate>" << cmXMLSafe(rev.CommitDate) + << "</CommitDate>\n" << "\t\t\t<Log>" << cmXMLSafe(rev.Log) << "</Log>\n" << "\t\t\t<Revision>" << cmXMLSafe(rev.Rev) << "</Revision>\n" << "\t\t\t<PriorRevision>" << cmXMLSafe(prior) << "</PriorRevision>\n" diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index d36bc8f..44e1dac 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -74,6 +74,9 @@ protected: std::string Date; std::string Author; std::string EMail; + std::string Committer; + std::string CommitterEMail; + std::string CommitDate; std::string Log; }; diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 29fcfc0..408dbac 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -55,7 +55,7 @@ void QCMakeThread::run() } CMakeSetupDialog::CMakeSetupDialog() - : ExitAfterGenerate(true), CacheModified(false), CurrentState(Interrupting) + : ExitAfterGenerate(true), CacheModified(false), ConfigureNeeded(true), CurrentState(Interrupting) { QString title = QString(tr("CMake %1")); title = title.arg(cmVersion::GetCMakeVersion()); @@ -167,6 +167,9 @@ CMakeSetupDialog::CMakeSetupDialog() this->CMakeThread->start(); this->enterState(ReadyConfigure); + + ProgressOffset = 0.0; + ProgressFactor = 1.0; } void CMakeSetupDialog::initialize() @@ -179,12 +182,11 @@ void CMakeSetupDialog::initialize() QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)), this, SLOT(doConfigure())); - QObject::connect(this->CMakeThread->cmakeInstance(), - SIGNAL(configureDone(int)), - this, SLOT(finishConfigure(int))); - QObject::connect(this->CMakeThread->cmakeInstance(), - SIGNAL(generateDone(int)), - this, SLOT(finishGenerate(int))); + + QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(configureDone(int)), + this, SLOT(exitLoop(int))); + QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(generateDone(int)), + this, SLOT(exitLoop(int))); QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)), this, SLOT(doGenerate())); @@ -270,15 +272,8 @@ CMakeSetupDialog::~CMakeSetupDialog() this->CMakeThread->wait(2000); } -void CMakeSetupDialog::doConfigure() +bool CMakeSetupDialog::prepareConfigure() { - if(this->CurrentState == Configuring) - { - // stop configure - doInterrupt(); - return; - } - // make sure build directory exists QString bindir = this->CMakeThread->cmakeInstance()->binaryDirectory(); QDir dir(bindir); @@ -295,7 +290,7 @@ void CMakeSetupDialog::doConfigure() QMessageBox::Yes | QMessageBox::No); if(btn == QMessageBox::No) { - return; + return false; } if(!dir.mkpath(".")) { @@ -303,7 +298,7 @@ void CMakeSetupDialog::doConfigure() QString(tr("Failed to create directory %1")).arg(dir.path()), QMessageBox::Ok); - return; + return false; } } @@ -312,27 +307,45 @@ void CMakeSetupDialog::doConfigure() { if(!this->setupFirstConfigure()) { - return; + return false; } } // remember path this->addBinaryPath(dir.absolutePath()); - this->enterState(Configuring); + return true; +} - this->CacheValues->selectionModel()->clear(); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "setProperties", Qt::QueuedConnection, - Q_ARG(QCMakePropertyList, - this->CacheValues->cacheModel()->properties())); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "configure", Qt::QueuedConnection); +void CMakeSetupDialog::exitLoop(int err) +{ + this->LocalLoop.exit(err); } -void CMakeSetupDialog::finishConfigure(int err) +void CMakeSetupDialog::doConfigure() { - if(0 == err && !this->CacheValues->cacheModel()->newPropertyCount()) + if(this->CurrentState == Configuring) + { + // stop configure + doInterrupt(); + return; + } + + if(!prepareConfigure()) + { + return; + } + + this->enterState(Configuring); + + bool ret = doConfigureInternal(); + + if(ret) + { + this->ConfigureNeeded = false; + } + + if(ret && !this->CacheValues->cacheModel()->newPropertyCount()) { this->enterState(ReadyGenerate); } @@ -341,6 +354,22 @@ void CMakeSetupDialog::finishConfigure(int err) this->enterState(ReadyConfigure); this->CacheValues->scrollToTop(); } + this->ProgressBar->reset(); +} + +bool CMakeSetupDialog::doConfigureInternal() +{ + this->Output->clear(); + this->CacheValues->selectionModel()->clear(); + + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "setProperties", Qt::QueuedConnection, + Q_ARG(QCMakePropertyList, + this->CacheValues->cacheModel()->properties())); + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "configure", Qt::QueuedConnection); + + int err = this->LocalLoop.exec(); if(err != 0) { @@ -348,23 +377,31 @@ void CMakeSetupDialog::finishConfigure(int err) tr("Error in configuration process, project files may be invalid"), QMessageBox::Ok); } + + return 0 == err; } -void CMakeSetupDialog::finishGenerate(int err) +void CMakeSetupDialog::doInstallForCommandLine() { - this->enterState(ReadyConfigure); + QMacInstallDialog setupdialog(0); + setupdialog.exec(); +} + +bool CMakeSetupDialog::doGenerateInternal() +{ + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "generate", Qt::QueuedConnection); + + int err = this->LocalLoop.exec(); + if(err != 0) { QMessageBox::critical(this, tr("Error"), tr("Error in generation process, project files may be invalid"), QMessageBox::Ok); } -} -void CMakeSetupDialog::doInstallForCommandLine() -{ - QMacInstallDialog setupdialog(0); - setupdialog.exec(); + return 0 == err; } void CMakeSetupDialog::doGenerate() @@ -375,9 +412,43 @@ void CMakeSetupDialog::doGenerate() doInterrupt(); return; } + + // see if we need to configure + // we'll need to configure if: + // the configure step hasn't been done yet + // generate was the last step done + if(this->ConfigureNeeded) + { + if(!prepareConfigure()) + { + return; + } + } + this->enterState(Generating); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "generate", Qt::QueuedConnection); + + bool config_passed = true; + if(this->ConfigureNeeded) + { + this->CacheValues->cacheModel()->setShowNewProperties(false); + this->ProgressFactor = 0.5; + config_passed = doConfigureInternal(); + this->ProgressOffset = 0.5; + } + + if(config_passed) + { + doGenerateInternal(); + } + + this->ProgressOffset = 0.0; + this->ProgressFactor = 1.0; + this->CacheValues->cacheModel()->setShowNewProperties(true); + + this->enterState(ReadyConfigure); + this->ProgressBar->reset(); + + this->ConfigureNeeded = true; } void CMakeSetupDialog::closeEvent(QCloseEvent* e) @@ -542,6 +613,7 @@ void CMakeSetupDialog::setSourceDirectory(const QString& dir) void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent) { + percent = (percent * ProgressFactor) + ProgressOffset; this->ProgressBar->setValue(qRound(percent * 100)); } @@ -883,7 +955,6 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) } else if(s == Configuring) { - this->Output->clear(); this->setEnabledState(false); this->GenerateButton->setEnabled(false); this->GenerateAction->setEnabled(false); @@ -899,17 +970,15 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) } else if(s == ReadyConfigure) { - this->ProgressBar->reset(); this->setEnabledState(true); - this->GenerateButton->setEnabled(false); - this->GenerateAction->setEnabled(false); + this->GenerateButton->setEnabled(true); + this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } else if(s == ReadyGenerate) { - this->ProgressBar->reset(); this->setEnabledState(true); this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 0e3caec..1934795 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -16,6 +16,7 @@ #include "QCMake.h" #include <QMainWindow> #include <QThread> +#include <QEventLoop> #include "ui_CMakeSetupDialog.h" class QCMakeThread; @@ -43,8 +44,6 @@ protected slots: void doHelp(); void doAbout(); void doInterrupt(); - void finishConfigure(int error); - void finishGenerate(int error); void error(const QString& message); void message(const QString& message); @@ -74,6 +73,10 @@ protected slots: void setGroupedView(bool); void showUserChanges(); void setSearchFilter(const QString& str); + bool prepareConfigure(); + bool doConfigureInternal(); + bool doGenerateInternal(); + void exitLoop(int); protected: @@ -87,6 +90,7 @@ protected: QCMakeThread* CMakeThread; bool ExitAfterGenerate; bool CacheModified; + bool ConfigureNeeded; QAction* ReloadCacheAction; QAction* DeleteCacheAction; QAction* ExitAction; @@ -99,6 +103,10 @@ protected: QTextCharFormat ErrorFormat; QTextCharFormat MessageFormat; + QEventLoop LocalLoop; + + float ProgressOffset; + float ProgressFactor; }; // QCMake instance on a thread diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index d90307a..562396d 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -200,6 +200,7 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p) NewPropertyCount(0), View(FlatView) { + this->ShowNewProperties = true; QStringList labels; labels << tr("Name") << tr("Value"); this->setHorizontalHeaderLabels(labels); @@ -214,6 +215,11 @@ static uint qHash(const QCMakeProperty& p) return qHash(p.Key); } +void QCMakeCacheModel::setShowNewProperties(bool f) +{ + this->ShowNewProperties = f; +} + void QCMakeCacheModel::clear() { this->QStandardItemModel::clear(); @@ -226,13 +232,21 @@ void QCMakeCacheModel::clear() void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) { - QSet<QCMakeProperty> newProps = props.toSet(); - QSet<QCMakeProperty> newProps2 = newProps; - QSet<QCMakeProperty> oldProps = this->properties().toSet(); - - oldProps.intersect(newProps); - newProps.subtract(oldProps); - newProps2.subtract(newProps); + QSet<QCMakeProperty> newProps, newProps2; + + if(this->ShowNewProperties) + { + newProps = props.toSet(); + newProps2 = newProps; + QSet<QCMakeProperty> oldProps = this->properties().toSet(); + oldProps.intersect(newProps); + newProps.subtract(oldProps); + newProps2.subtract(newProps); + } + else + { + newProps2 = props.toSet(); + } bool b = this->blockSignals(true); diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index 401e07e..58bbd2d 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -78,6 +78,9 @@ public slots: // become new properties and be marked red. void setProperties(const QCMakePropertyList& props); + // set whether to show new properties in red + void setShowNewProperties(bool); + // clear everything from the model void clear(); @@ -115,6 +118,7 @@ public: protected: bool EditEnabled; int NewPropertyCount; + bool ShowNewProperties; ViewType View; // set the data in the model for this property diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index f6b3234..7af6ec8 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -161,6 +161,7 @@ bool cmAddCustomCommandCommand filename += "/"; } filename += copy; + cmSystemTools::ConvertToUnixSlashes(filename); break; case doing_source: // We do not want to convert the argument to SOURCE because diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 2baacbf..c8374db 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -341,7 +341,7 @@ bool cmCacheManager::LoadCache(const char* path, std::string("The current CMakeCache.txt directory ") + currentcwd + std::string(" is different than the directory ") + std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + - std::string(" where CMackeCache.txt was created. This may result " + std::string(" where CMakeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"); cmSystemTools::Error(message.c_str()); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index b8a0c95..0fe64ad 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -169,8 +169,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator() ->GetLanguageFromExtension(ext.c_str())); const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH"); - fprintf(fout, "cmake_minimum_required(VERSION %u.%u)\n", - cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion()); + fprintf(fout, "cmake_minimum_required(VERSION %u.%u.%u.%u)\n", + cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion(), + cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion()); if(def) { fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def); @@ -396,28 +397,18 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) } else { - if(!cmSystemTools::RemoveFile(fullPath.c_str())) + // Sometimes anti-virus software hangs on to new files so we + // cannot delete them immediately. Try a few times. + int tries = 5; + while(!cmSystemTools::RemoveFile(fullPath.c_str()) && + --tries && cmSystemTools::FileExists(fullPath.c_str())) { - bool removed = false; - int numAttempts = 0; - // sometimes anti-virus software hangs on to - // new files and we can not delete them, so try - // 5 times with .5 second delay between tries. - while(!removed && numAttempts < 5) - { - cmSystemTools::Delay(500); - if(cmSystemTools::RemoveFile(fullPath.c_str())) - { - removed = true; - } - numAttempts++; - } - if(!removed) - { - std::string m = "Remove failed on file: "; - m += fullPath; - cmSystemTools::ReportLastSystemError(m.c_str()); - } + cmSystemTools::Delay(500); + } + if(tries == 0) + { + std::string m = "Remove failed on file: " + fullPath; + cmSystemTools::ReportLastSystemError(m.c_str()); } } } diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 69ff858..19558fa 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -25,7 +25,7 @@ cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir): Verbose(false), FileComparison(0), TargetDirectory(targetDir), - MaxPath(cmSystemTools::GetMaximumFilePathLength()), + MaxPath(16384), Dependee(new char[MaxPath]), Depender(new char[MaxPath]) { diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 8f89b5e..502fefa 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -734,6 +734,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const ; emmited.clear(); const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + const std::string makeArgs = mf->GetSafeDefinition( + "CMAKE_ECLIPSE_MAKE_ARGUMENTS"); cmGlobalGenerator* generator = const_cast<cmGlobalGenerator*>(this->GlobalGenerator); @@ -794,7 +796,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const } if (insertTarget) { - this->AppendTarget(fout, ti->first, make, subdir, ": "); + this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": "); } } break; @@ -809,7 +811,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const break; } - this->AppendTarget(fout, ti->first, make, subdir, ": "); + this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": "); break; case cmTarget::EXECUTABLE: case cmTarget::STATIC_LIBRARY: @@ -818,10 +820,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ? "[exe] " : "[lib] "); - this->AppendTarget(fout, ti->first, make, subdir, prefix); + this->AppendTarget(fout, ti->first, make, makeArgs, subdir, prefix); std::string fastTarget = ti->first; fastTarget += "/fast"; - this->AppendTarget(fout, fastTarget, make, subdir, prefix); + this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix); } break; // ignore these: @@ -836,11 +838,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // insert the all and clean targets in every subdir if (!allTarget.empty()) { - this->AppendTarget(fout, allTarget, make, subdir, ": "); + this->AppendTarget(fout, allTarget, make, makeArgs, subdir, ": "); } if (!cleanTarget.empty()) { - this->AppendTarget(fout, cleanTarget, make, subdir, ": "); + this->AppendTarget(fout, cleanTarget, make, makeArgs, subdir, ": "); } //insert rules for compiling, preprocessing and assembling individual files @@ -860,7 +862,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { prefix = "[pre] "; } - this->AppendTarget(fout, *fit, make, subdir, prefix); + this->AppendTarget(fout, *fit, make, makeArgs, subdir, prefix); } } @@ -993,6 +995,7 @@ void cmExtraEclipseCDT4Generator void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout, const std::string& target, const std::string& make, + const std::string& makeArgs, const std::string& path, const char* prefix) { @@ -1003,7 +1006,7 @@ void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout, "<buildCommand>" << cmExtraEclipseCDT4Generator::GetEclipsePath(make) << "</buildCommand>\n" - "<buildArguments/>\n" + "<buildArguments>" << makeArgs << "</buildArguments>\n" "<buildTarget>" << target << "</buildTarget>\n" "<stopOnError>true</stopOnError>\n" "<useDefaultCommand>false</useDefaultCommand>\n" diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 2ad599d..99e69c4 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -71,6 +71,7 @@ private: static void AppendTarget (cmGeneratedFileStream& fout, const std::string& target, const std::string& make, + const std::string& makeArguments, const std::string& path, const char* prefix = ""); static void AppendScannerProfile (cmGeneratedFileStream& fout, diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index e771092..b11dcde 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -116,7 +116,12 @@ public: "expressions and store it into the variable. Globbing expressions " "are similar to regular expressions, but much simpler. If RELATIVE " "flag is specified for an expression, the results will be returned " - "as a relative path to the given path.\n" + "as a relative path to the given path. " + "(We do not recommend using GLOB to collect a list of source files " + "from your source tree. If no CMakeLists.txt file changes when a " + "source is added or removed then the generated build system cannot " + "know when to ask CMake to regenerate.)" + "\n" "Examples of globbing expressions include:\n" " *.cxx - match all files with extension cxx\n" " *.vt? - match all files with extension vta,...,vtz\n" diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f558509..123ab5e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -814,24 +814,11 @@ void cmGlobalGenerator::Generate() // For each existing cmLocalGenerator unsigned int i; - // Consolidate global targets + // Put a copy of each global target in every directory. cmTargets globalTargets; this->CreateDefaultGlobalTargets(&globalTargets); for (i = 0; i < this->LocalGenerators.size(); ++i) { - cmTargets* targets = - &(this->LocalGenerators[i]->GetMakefile()->GetTargets()); - cmTargets::iterator tarIt; - for ( tarIt = targets->begin(); tarIt != targets->end(); ++ tarIt ) - { - if ( tarIt->second.GetType() == cmTarget::GLOBAL_TARGET ) - { - globalTargets[tarIt->first] = tarIt->second; - } - } - } - for (i = 0; i < this->LocalGenerators.size(); ++i) - { cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); cmTargets* targets = &(mf->GetTargets()); cmTargets::iterator tit; @@ -1881,8 +1868,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( const char* name, const char* message, const cmCustomCommandLines* commandLines, std::vector<std::string> depends, - const char* workingDirectory, - bool depends_on_all /* = false */) + const char* workingDirectory) { // Package cmTarget target; @@ -1897,10 +1883,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( workingDirectory); target.GetPostBuildCommands().push_back(cc); target.SetProperty("EchoString", message); - if ( depends_on_all ) - { - target.AddUtility("all"); - } std::vector<std::string>::iterator dit; for ( dit = depends.begin(); dit != depends.end(); ++ dit ) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7e43124..6a1aa53 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -291,8 +291,7 @@ protected: void CreateDefaultGlobalTargets(cmTargets* targets); cmTarget CreateGlobalTarget(const char* name, const char* message, const cmCustomCommandLines* commandLines, - std::vector<std::string> depends, const char* workingDir, - bool depends_on_all = false); + std::vector<std::string> depends, const char* workingDir); bool NeedSymbolicMark; bool UseLinkScript; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 403507f..0b939af 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -19,6 +19,10 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() { this->FindMakeProgramFile = "CMakeVS10FindMake.cmake"; + std::string vc10Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" + "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); } //---------------------------------------------------------------------------- @@ -63,6 +67,16 @@ void cmGlobalVisualStudio10Generator } //---------------------------------------------------------------------------- +const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() +{ + if(!this->PlatformToolset.empty()) + { + return this->PlatformToolset.c_str(); + } + return 0; +} + +//---------------------------------------------------------------------------- std::string cmGlobalVisualStudio10Generator::GetUserMacrosDirectory() { std::string base; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 219c36e..bef5642 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -54,6 +54,12 @@ public: cmMakefile *, bool optional); virtual void WriteSLNHeader(std::ostream& fout); + /** Is the installed VS an Express edition? */ + bool IsExpressEdition() const { return this->ExpressEdition; } + + /** The toolset name for the target platform. */ + const char* GetPlatformToolset(); + /** * Where does this version of Visual Studio look for macros for the * current user? Returns the empty string if this version of Visual @@ -70,5 +76,9 @@ public: { return "$(Configuration)";} protected: virtual const char* GetIDEVersion() { return "10.0"; } + + std::string PlatformToolset; +private: + bool ExpressEdition; }; #endif diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx index 109b60d..8600777 100644 --- a/Source/cmGlobalVisualStudio10Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx @@ -36,3 +36,52 @@ void cmGlobalVisualStudio10Win64Generator mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } + +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio10Win64Generator::Find64BitTools(cmMakefile* mf) +{ + if(!this->PlatformToolset.empty()) + { + return true; + } + // This edition does not come with 64-bit tools. Look for them. + // + // TODO: Detect available tools? x64\v100 exists but does not work? + // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath + // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/ + // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK} + std::string winSDK_7_1; + if(cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\" + "Windows\\v7.1;InstallationFolder", winSDK_7_1)) + { + cmOStringStream m; + m << "Found Windows SDK v7.1: " << winSDK_7_1; + mf->DisplayStatus(m.str().c_str(), -1); + this->PlatformToolset = "Windows7.1SDK"; + return true; + } + else + { + cmOStringStream e; + e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n" + << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n" + << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx"; + mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + cmSystemTools::SetFatalErrorOccured(); + return false; + } +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio10Win64Generator +::EnableLanguage(std::vector<std::string> const& languages, + cmMakefile* mf, bool optional) +{ + if(this->IsExpressEdition() && !this->Find64BitTools(mf)) + { + return; + } + this->cmGlobalVisualStudio10Generator + ::EnableLanguage(languages, mf, optional); +} diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h index 39c9d08..e6d3dc5 100644 --- a/Source/cmGlobalVisualStudio10Win64Generator.h +++ b/Source/cmGlobalVisualStudio10Win64Generator.h @@ -34,5 +34,8 @@ public: virtual void AddPlatformDefinitions(cmMakefile* mf); + bool Find64BitTools(cmMakefile* mf); + virtual void EnableLanguage(std::vector<std::string>const& languages, + cmMakefile *, bool optional); }; #endif diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 203ca77..fe44e20 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -197,8 +197,6 @@ void cmGlobalVisualStudio6Generator this->GetTargetSets(projectTargets, originalTargets, root, generators); OrderedTargetDependSet orderedProjectTargets(projectTargets); - std::string rootdir = root->GetMakefile()->GetStartOutputDirectory(); - rootdir += "/"; for(OrderedTargetDependSet::const_iterator tt = orderedProjectTargets.begin(); tt != orderedProjectTargets.end(); ++tt) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index ba18687..adb5f2f 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -182,8 +182,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, std::string guid = this->GetGUID(dspname); fout << project << dspname << "\", \"" - << this->ConvertToSolutionPath(dir) - << "\\" << dspname << ext << "\", \"{" << guid << "}\"\n"; + << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") + << dspname << ext << "\", \"{" << guid << "}\"\n"; fout << "\tProjectSection(ProjectDependencies) = postProject\n"; this->WriteProjectDepends(fout, dspname, dir, t); fout << "\tEndProjectSection\n"; @@ -196,8 +196,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, const char* uname = ui->second.c_str(); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << uname << "\", \"" - << this->ConvertToSolutionPath(dir) - << "\\" << uname << ".vcproj" << "\", \"{" + << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") + << uname << ".vcproj" << "\", \"{" << this->GetGUID(uname) << "}\"\n" << "\tProjectSection(ProjectDependencies) = postProject\n" << "\t\t{" << guid << "} = {" << guid << "}\n" diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 45d6a74..51b8918 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -273,8 +273,6 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( cmLocalGenerator* root, OrderedTargetDependSet const& projectTargets) { - std::string rootdir = root->GetMakefile()->GetStartOutputDirectory(); - rootdir += "/"; for(OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { @@ -301,6 +299,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( std::string dir = tmf->GetStartOutputDirectory(); dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT); + if(dir == ".") + { + dir = ""; // msbuild cannot handle ".\" prefix + } this->WriteProject(fout, vcprojName, dir.c_str(), *target); written = true; @@ -516,8 +518,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, fout << project << dspname << "\", \"" - << this->ConvertToSolutionPath(dir) - << "\\" << dspname << ext << "\", \"{" + << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") + << dspname << ext << "\", \"{" << this->GetGUID(dspname) << "}\"\nEndProject\n"; UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target); @@ -526,8 +528,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, const char* uname = ui->second.c_str(); fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << uname << "\", \"" - << this->ConvertToSolutionPath(dir) - << "\\" << uname << ".vcproj" << "\", \"{" + << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") + << uname << ".vcproj" << "\", \"{" << this->GetGUID(uname) << "}\"\n" << "EndProject\n"; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e13acda..59ca38f 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2617,7 +2617,10 @@ void cmGlobalXCodeGenerator group->AddAttribute("BuildIndependentTargetsInParallel", this->CreateString("YES")); this->RootObject->AddAttribute("attributes", group); - if (this->XcodeVersion >= 31) + if (this->XcodeVersion >= 32) + this->RootObject->AddAttribute("compatibilityVersion", + this->CreateString("Xcode 3.2")); + else if (this->XcodeVersion >= 31) this->RootObject->AddAttribute("compatibilityVersion", this->CreateString("Xcode 3.1")); else @@ -3023,7 +3026,9 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout, cmXCodeObject::Indent(1, fout); if(this->XcodeVersion >= 21) { - if (this->XcodeVersion >= 31) + if (this->XcodeVersion >= 32) + fout << "objectVersion = 46;\n"; + else if (this->XcodeVersion >= 31) fout << "objectVersion = 45;\n"; else if (this->XcodeVersion >= 30) fout << "objectVersion = 44;\n"; diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 57d8653..de2a837 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -117,3 +117,9 @@ void cmLocalVisualStudio10Generator "Stored GUID", cmCacheManager::INTERNAL); } + +//---------------------------------------------------------------------------- +std::string cmLocalVisualStudio10Generator::CheckForErrorLine() +{ + return "if errorlevel 1 goto :VCEnd"; +} diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 5694220..06b8b09 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -36,6 +36,10 @@ public: virtual void Generate(); virtual void ReadAndStoreExternalGUID(const char* name, const char* path); + +protected: + virtual std::string CheckForErrorLine(); + private: }; #endif diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index a044363..9164beb 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -150,6 +150,18 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements } //---------------------------------------------------------------------------- +std::string cmLocalVisualStudioGenerator::CheckForErrorLine() +{ + return "if errorlevel 1 goto :VCReportError"; +} + +//---------------------------------------------------------------------------- +std::string cmLocalVisualStudioGenerator::GetCheckForErrorLine() +{ + return this->CheckForErrorLine(); +} + +//---------------------------------------------------------------------------- std::string cmLocalVisualStudioGenerator ::ConstructScript(cmCustomCommand const& cc, @@ -216,7 +228,7 @@ cmLocalVisualStudioGenerator // sequence. // script += newline_text; - script += "if errorlevel 1 goto VCReportError"; + script += this->GetCheckForErrorLine(); } return script; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 551b01c..1954ac5 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -31,12 +31,19 @@ class cmLocalVisualStudioGenerator : public cmLocalGenerator public: cmLocalVisualStudioGenerator(); virtual ~cmLocalVisualStudioGenerator(); + /** Construct a script from the given list of command lines. */ std::string ConstructScript(cmCustomCommand const& cc, const char* configName, const char* newline = "\n"); + /** Line of batch file text that skips to the end after + * a failed step in a sequence of custom commands. + */ + std::string GetCheckForErrorLine(); + protected: + virtual std::string CheckForErrorLine(); /** Construct a custom command to make exe import lib dir. */ cmsys::auto_ptr<cmCustomCommand> diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3bce01c..cf03b80 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1365,8 +1365,8 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target, cmOStringStream e; e << "Attempt to add link library \"" << lib << "\" to target \"" - << target << "\" which is not built by this project."; - cmSystemTools::Error(e.str().c_str()); + << target << "\" which is not built in this directory."; + this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); } } @@ -3591,6 +3591,12 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name) return imported->second; } + // Look for a target built in this directory. + if(cmTarget* t = this->FindTarget(name)) + { + return t; + } + // Look for a target built in this project. return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name); } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 6b290ab..9dcd8f1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -849,7 +849,7 @@ cmMakefileTargetGenerator p_depends.push_back(relativeObj); this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, temp.c_str(), p_depends, no_commands, - true); + false); } //---------------------------------------------------------------------------- @@ -1527,6 +1527,12 @@ void cmMakefileTargetGenerator this->LocalGenerator->AppendRuleDepend(depends, this->BuildFileNameFull.c_str()); + // Add a dependency on the link definitions file, if any. + if(!this->ModuleDefinitionFile.empty()) + { + depends.push_back(this->ModuleDefinitionFile); + } + // Add dependencies on the external object files. for(std::vector<std::string>::const_iterator obj = this->ExternalObjects.begin(); @@ -1723,8 +1729,6 @@ const char* cmMakefileTargetGenerator::GetFortranModuleDirectory() this->Target->GetProperty("Fortran_MODULE_DIRECTORY"); const char* moddir_flag = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_FLAG"); - const char* moddir_default = - this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); if(target_mod_dir && moddir_flag) { // Compute the full path to the module directory. @@ -1745,10 +1749,6 @@ const char* cmMakefileTargetGenerator::GetFortranModuleDirectory() // Make sure the module output directory exists. cmSystemTools::MakeDirectory(this->FortranModuleDirectory.c_str()); } - else if(moddir_default && moddir_flag) - { - this->FortranModuleDirectory = moddir_default; - } this->FortranModuleDirectoryComputed = true; } @@ -1774,7 +1774,12 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) } // Add a module output directory flag if necessary. - if(const char* mod_dir = this->GetFortranModuleDirectory()) + const char* mod_dir = this->GetFortranModuleDirectory(); + if(!mod_dir) + { + mod_dir = this->Makefile->GetDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); + } + if(mod_dir) { const char* moddir_flag = this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index b793cd5..26328cf 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -472,7 +472,9 @@ void cmSourceFile::DefineProperties(cmake *cm) "What programming language is the file.", "A property that can be set to indicate what programming language " "the source file is. If it is not set the language is determined " - "based on the file extension. Typical values are CXX C etc."); + "based on the file extension. Typical values are CXX C etc. Setting " + "this property for a file means this file will be compiled. " + "Do not set this for header or files that should not be compiled."); cm->DefineProperty ("LOCATION", cmProperty::SOURCE_FILE, diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 19f5c0f..2b4414d 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -606,7 +606,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& return false; } int leftOverLength = intStringLength - begin; - if ( end < 0 || end > leftOverLength ) + if ( end < -1 || end > leftOverLength ) { cmOStringStream ostr; ostr << "end index: " << end << " is out of range " << 0 << " - " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 40f68e4..9a698c0 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1467,6 +1467,15 @@ cmTargetTraceDependencies //---------------------------------------------------------------------------- void cmTarget::TraceDependencies(const char* vsProjectFile) { + // CMake-generated targets have no dependencies to trace. Normally tracing + // would find nothing anyway, but when building CMake itself the "install" + // target command ends up referencing the "cmake" target but we do not + // really want the dependency because "install" depend on "all" anyway. + if(this->GetType() == cmTarget::GLOBAL_TARGET) + { + return; + } + // Use a helper object to trace the dependencies. cmTargetTraceDependencies tracer(this, this->Internal.Get(), vsProjectFile); tracer.Trace(); @@ -3213,6 +3222,7 @@ void cmTarget::GetLibraryNames(std::string& name, // the library version as the soversion. soversion = version; } + bool isApple = this->Makefile->IsOn("APPLE"); // Get the components of the library name. std::string prefix; @@ -3224,26 +3234,33 @@ void cmTarget::GetLibraryNames(std::string& name, name = prefix+base+suffix; // The library's soname. -#if defined(__APPLE__) - soName = prefix+base; -#else - soName = name; -#endif + if(isApple) + { + soName = prefix+base; + } + else + { + soName = name; + } if(soversion) { soName += "."; soName += soversion; } -#if defined(__APPLE__) - soName += suffix; -#endif + if(isApple) + { + soName += suffix; + } // The library's real name on disk. -#if defined(__APPLE__) - realName = prefix+base; -#else + if(isApple) + { + realName = prefix+base; + } + else + { realName = name; -#endif + } if(version) { realName += "."; @@ -3254,9 +3271,10 @@ void cmTarget::GetLibraryNames(std::string& name, realName += "."; realName += soversion; } -#if defined(__APPLE__) - realName += suffix; -#endif + if(isApple) + { + realName += suffix; + } // The import library name. if(this->GetType() == cmTarget::SHARED_LIBRARY || diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 43a0d7c..ce57df7 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -62,6 +62,10 @@ public: " target_link_libraries(<target> [item1 [item2 [...]]]\n" " [[debug|optimized|general] <item>] ...)\n" "Specify libraries or flags to use when linking a given target. " + "The named <target> must have been created in the current directory " + "by a command such as add_executable or add_library. " + "The remaining arguments specify library names or flags." + "\n" "If a library name matches that of another target in the project " "a dependency will automatically be added in the build system to make " "sure the library being linked is up-to-date before the target links. " diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index eb8320c..20ed5a8 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -244,6 +244,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { + cmGlobalVisualStudio10Generator* gg = + static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); @@ -291,6 +293,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2); } + if(const char* toolset = gg->GetPlatformToolset()) + { + std::string pts = "<PlatformToolset>"; + pts += toolset; + pts += "</PlatformToolset>\n"; + this->WriteString(pts.c_str(), 2); + } this->WriteString("</PropertyGroup>\n", 1); } } @@ -685,7 +694,7 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() } (*this->BuildFileStream ) << sourceFile << "\""; // ouput any flags specific to this source file - if(cl && this->OutputSourceSpecificFlags(*source)) + if(!header && cl && this->OutputSourceSpecificFlags(*source)) { // if the source file has specific flags the tag // is ended on a new line diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index f1bad9c..9acae0d 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -85,17 +85,15 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose) // was not given explicitly in the flags we want to add an attribute // to the generated project to disable logo suppression. Otherwise // the GUI default is to enable suppression. + // + // Avoid this on Visual Studio 10 (and later!) because it results in: + // "cl ... warning D9035: option 'nologo-' has been deprecated" + // if(verbose && + this->Version != 10 && this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end()) { - if(this->Version == 10) - { - this->FlagMap["SuppressStartupBanner"] = "false"; - } - else - { - this->FlagMap["SuppressStartupBanner"] = "FALSE"; - } + this->FlagMap["SuppressStartupBanner"] = "FALSE"; } } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ddfdc24..1b49837 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3815,6 +3815,10 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type) { hasIncremental = true; } + if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL") == 0) + { + hasIncremental = true; + } if(cmSystemTools::Strucmp(i->c_str(), "/MANIFEST:NO") == 0) { hasManifest = false; diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 18cae43..a35a01f 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -237,10 +237,10 @@ IF(COMMAND INSTALL) # Setup library install rules. SET(KWSYS_INSTALL_LIBRARY_RULE) - IF(KWSYS_INSTALL_EXPORT_NAME) - LIST(APPEND KWSYS_INSTALL_LIBRARY_RULE EXPORT ${KWSYS_INSTALL_EXPORT_NAME}) - ENDIF() IF(KWSYS_INSTALL_LIB_DIR) + IF(KWSYS_INSTALL_EXPORT_NAME) + LIST(APPEND KWSYS_INSTALL_LIBRARY_RULE EXPORT ${KWSYS_INSTALL_EXPORT_NAME}) + ENDIF() # Install the shared library to the lib directory. SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE} LIBRARY DESTINATION ${KWSYS_INSTALL_LIB_DIR} diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 4818ce9..d727b32 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -151,10 +151,6 @@ public: void RunMemoryCheck(); public: -#define VENDOR_STRING_LENGTH (12 + 1) -#define CHIPNAME_STRING_LENGTH (48 + 1) -#define SERIALNUMBER_STRING_LENGTH (29 + 1) - typedef struct tagID { int Type; @@ -163,9 +159,9 @@ public: int Revision; int ExtendedFamily; int ExtendedModel; - char ProcessorName[CHIPNAME_STRING_LENGTH]; - char Vendor[VENDOR_STRING_LENGTH]; - char SerialNumber[SERIALNUMBER_STRING_LENGTH]; + kwsys_stl::string ProcessorName; + kwsys_stl::string Vendor; + kwsys_stl::string SerialNumber; } ID; typedef struct tagCPUPowerManagement @@ -530,7 +526,12 @@ SystemInformationImplementation::SystemInformationImplementation() this->CurrentPositionInFile = 0; this->ChipManufacturer = UnknownManufacturer; memset(&this->Features, 0, sizeof(CPUFeatures)); - memset(&this->ChipID, 0, sizeof(ID)); + this->ChipID.Type = 0; + this->ChipID.Family = 0; + this->ChipID.Model = 0; + this->ChipID.Revision = 0; + this->ChipID.ExtendedFamily = 0; + this->ChipID.ExtendedModel = 0; this->CPUSpeedInMHz = 0; this->NumberOfLogicalCPU = 0; this->NumberOfPhysicalCPU = 0; @@ -623,7 +624,7 @@ void SystemInformationImplementation::RunMemoryCheck() /** Get the vendor string */ const char * SystemInformationImplementation::GetVendorString() { - return this->ChipID.Vendor; + return this->ChipID.Vendor.c_str(); } /** Get the OS Name */ @@ -726,14 +727,14 @@ kwsys_stl::string SystemInformationImplementation::GetSteppingCode() /** Return the stepping code of the CPU present. */ const char * SystemInformationImplementation::GetExtendedProcessorName() { - return this->ChipID.ProcessorName; + return this->ChipID.ProcessorName.c_str(); } /** Return the serial number of the processor * in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */ const char * SystemInformationImplementation::GetProcessorSerialNumber() { - return this->ChipID.SerialNumber; + return this->ChipID.SerialNumber.c_str(); } /** Return the logical processors per physical */ @@ -1022,21 +1023,21 @@ bool SystemInformationImplementation::RetrieveCPUFeatures() /** Find the manufacturer given the vendor id */ void SystemInformationImplementation::FindManufacturer() { - if (strcmp (this->ChipID.Vendor, "GenuineIntel") == 0) this->ChipManufacturer = Intel; // Intel Corp. - else if (strcmp (this->ChipID.Vendor, "UMC UMC UMC ") == 0) this->ChipManufacturer = UMC; // United Microelectronics Corp. - else if (strcmp (this->ChipID.Vendor, "AuthenticAMD") == 0) this->ChipManufacturer = AMD; // Advanced Micro Devices - else if (strcmp (this->ChipID.Vendor, "AMD ISBETTER") == 0) this->ChipManufacturer = AMD; // Advanced Micro Devices (1994) - else if (strcmp (this->ChipID.Vendor, "CyrixInstead") == 0) this->ChipManufacturer = Cyrix; // Cyrix Corp., VIA Inc. - else if (strcmp (this->ChipID.Vendor, "NexGenDriven") == 0) this->ChipManufacturer = NexGen; // NexGen Inc. (now AMD) - else if (strcmp (this->ChipID.Vendor, "CentaurHauls") == 0) this->ChipManufacturer = IDT; // IDT/Centaur (now VIA) - else if (strcmp (this->ChipID.Vendor, "RiseRiseRise") == 0) this->ChipManufacturer = Rise; // Rise - else if (strcmp (this->ChipID.Vendor, "GenuineTMx86") == 0) this->ChipManufacturer = Transmeta; // Transmeta - else if (strcmp (this->ChipID.Vendor, "TransmetaCPU") == 0) this->ChipManufacturer = Transmeta; // Transmeta - else if (strcmp (this->ChipID.Vendor, "Geode By NSC") == 0) this->ChipManufacturer = NSC; // National Semiconductor - else if (strcmp (this->ChipID.Vendor, "Sun") == 0) this->ChipManufacturer = Sun; // Sun Microelectronics - else if (strcmp (this->ChipID.Vendor, "IBM") == 0) this->ChipManufacturer = IBM; // IBM Microelectronics - else if (strcmp (this->ChipID.Vendor, "Motorola") == 0) this->ChipManufacturer = Motorola; // Motorola Microelectronics - else this->ChipManufacturer = UnknownManufacturer; // Unknown manufacturer + if (this->ChipID.Vendor == "GenuineIntel") this->ChipManufacturer = Intel; // Intel Corp. + else if (this->ChipID.Vendor == "UMC UMC UMC ") this->ChipManufacturer = UMC; // United Microelectronics Corp. + else if (this->ChipID.Vendor == "AuthenticAMD") this->ChipManufacturer = AMD; // Advanced Micro Devices + else if (this->ChipID.Vendor == "AMD ISBETTER") this->ChipManufacturer = AMD; // Advanced Micro Devices (1994) + else if (this->ChipID.Vendor == "CyrixInstead") this->ChipManufacturer = Cyrix; // Cyrix Corp., VIA Inc. + else if (this->ChipID.Vendor == "NexGenDriven") this->ChipManufacturer = NexGen; // NexGen Inc. (now AMD) + else if (this->ChipID.Vendor == "CentaurHauls") this->ChipManufacturer = IDT; // IDT/Centaur (now VIA) + else if (this->ChipID.Vendor == "RiseRiseRise") this->ChipManufacturer = Rise; // Rise + else if (this->ChipID.Vendor == "GenuineTMx86") this->ChipManufacturer = Transmeta; // Transmeta + else if (this->ChipID.Vendor == "TransmetaCPU") this->ChipManufacturer = Transmeta; // Transmeta + else if (this->ChipID.Vendor == "Geode By NSC") this->ChipManufacturer = NSC; // National Semiconductor + else if (this->ChipID.Vendor == "Sun") this->ChipManufacturer = Sun; // Sun Microelectronics + else if (this->ChipID.Vendor == "IBM") this->ChipManufacturer = IBM; // IBM Microelectronics + else if (this->ChipID.Vendor == "Motorola") this->ChipManufacturer = Motorola; // Motorola Microelectronics + else this->ChipManufacturer = UnknownManufacturer; // Unknown manufacturer } @@ -1094,10 +1095,12 @@ bool SystemInformationImplementation::RetrieveCPUIdentity() } // Process the returned information. - memcpy (this->ChipID.Vendor, &(localCPUVendor[0]), sizeof (int)); - memcpy (&(this->ChipID.Vendor[4]), &(localCPUVendor[1]), sizeof (int)); - memcpy (&(this->ChipID.Vendor[8]), &(localCPUVendor[2]), sizeof (int)); - this->ChipID.Vendor[12] = '\0'; + char vbuf[13]; + memcpy (&(vbuf[0]), &(localCPUVendor[0]), sizeof (int)); + memcpy (&(vbuf[4]), &(localCPUVendor[1]), sizeof (int)); + memcpy (&(vbuf[8]), &(localCPUVendor[2]), sizeof (int)); + vbuf[12] = '\0'; + this->ChipID.Vendor = vbuf; this->FindManufacturer(); @@ -1792,7 +1795,8 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber() } // Process the returned information. - sprintf (this->ChipID.SerialNumber, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x", + char sn[128]; + sprintf (sn, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x", ((SerialNumber[0] & 0xff000000) >> 24), ((SerialNumber[0] & 0x00ff0000) >> 16), ((SerialNumber[0] & 0x0000ff00) >> 8), @@ -1805,7 +1809,7 @@ bool SystemInformationImplementation::RetrieveProcessorSerialNumber() ((SerialNumber[2] & 0x00ff0000) >> 16), ((SerialNumber[2] & 0x0000ff00) >> 8), ((SerialNumber[2] & 0x000000ff) >> 0)); - + this->ChipID.SerialNumber = sn; return true; #else @@ -1873,6 +1877,15 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement() #endif } +void SystemInformationStripLeadingSpace(kwsys_stl::string& str) +{ + // Because some manufacturers have leading white space - we have to post-process the name. + kwsys_stl::string::size_type pos = str.find_first_not_of(" "); + if(pos != kwsys_stl::string::npos) + { + str = str.substr(pos); + } +} /** */ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() @@ -1886,7 +1899,6 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() return false; #if USE_ASM_INSTRUCTIONS - int ProcessorNameStartPos = 0; int CPUExtendedIdentity[12]; // Use assembly to detect CPUID information... @@ -1942,47 +1954,25 @@ bool SystemInformationImplementation::RetrieveExtendedCPUIdentity() } // Process the returned information. - memcpy (this->ChipID.ProcessorName, &(CPUExtendedIdentity[0]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[4]), &(CPUExtendedIdentity[1]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[8]), &(CPUExtendedIdentity[2]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[12]), &(CPUExtendedIdentity[3]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[16]), &(CPUExtendedIdentity[4]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[20]), &(CPUExtendedIdentity[5]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[24]), &(CPUExtendedIdentity[6]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[28]), &(CPUExtendedIdentity[7]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[32]), &(CPUExtendedIdentity[8]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[36]), &(CPUExtendedIdentity[9]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[40]), &(CPUExtendedIdentity[10]), sizeof (int)); - memcpy (&(this->ChipID.ProcessorName[44]), &(CPUExtendedIdentity[11]), sizeof (int)); - this->ChipID.ProcessorName[48] = '\0'; + char nbuf[49]; + memcpy (&(nbuf[0]), &(CPUExtendedIdentity[0]), sizeof (int)); + memcpy (&(nbuf[4]), &(CPUExtendedIdentity[1]), sizeof (int)); + memcpy (&(nbuf[8]), &(CPUExtendedIdentity[2]), sizeof (int)); + memcpy (&(nbuf[12]), &(CPUExtendedIdentity[3]), sizeof (int)); + memcpy (&(nbuf[16]), &(CPUExtendedIdentity[4]), sizeof (int)); + memcpy (&(nbuf[20]), &(CPUExtendedIdentity[5]), sizeof (int)); + memcpy (&(nbuf[24]), &(CPUExtendedIdentity[6]), sizeof (int)); + memcpy (&(nbuf[28]), &(CPUExtendedIdentity[7]), sizeof (int)); + memcpy (&(nbuf[32]), &(CPUExtendedIdentity[8]), sizeof (int)); + memcpy (&(nbuf[36]), &(CPUExtendedIdentity[9]), sizeof (int)); + memcpy (&(nbuf[40]), &(CPUExtendedIdentity[10]), sizeof (int)); + memcpy (&(nbuf[44]), &(CPUExtendedIdentity[11]), sizeof (int)); + nbuf[48] = '\0'; + this->ChipID.ProcessorName = nbuf; // Because some manufacturers have leading white space - we have to post-process the name. - if (this->ChipManufacturer == Intel) - { - for (int nCounter = 0; nCounter < CHIPNAME_STRING_LENGTH; nCounter ++) - { - // There will either be NULL (\0) or spaces ( ) as the leading characters. - if ((this->ChipID.ProcessorName[nCounter] != '\0') && (this->ChipID.ProcessorName[nCounter] != ' ')) - { - // We have found the starting position of the name. - ProcessorNameStartPos = nCounter; - // Terminate the loop. - break; - } - } - - // Check to see if there is any white space at the start. - if (ProcessorNameStartPos == 0) - { - return true; - } - - // Now move the name forward so that there is no white space. - memmove(this->ChipID.ProcessorName, &(this->ChipID.ProcessorName[ProcessorNameStartPos]), (CHIPNAME_STRING_LENGTH - ProcessorNameStartPos)); - } - + SystemInformationStripLeadingSpace(this->ChipID.ProcessorName); return true; - #else return false; #endif @@ -1999,53 +1989,53 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() // Check the family / model / revision to determine the CPU ID. switch (this->ChipID.Family) { case 3: - sprintf (this->ChipID.ProcessorName, "Newer i80386 family"); + this->ChipID.ProcessorName = "Newer i80386 family"; break; case 4: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"i80486DX-25/33"); break; - case 1: sprintf (this->ChipID.ProcessorName,"i80486DX-50"); break; - case 2: sprintf (this->ChipID.ProcessorName,"i80486SX"); break; - case 3: sprintf (this->ChipID.ProcessorName,"i80486DX2"); break; - case 4: sprintf (this->ChipID.ProcessorName,"i80486SL"); break; - case 5: sprintf (this->ChipID.ProcessorName,"i80486SX2"); break; - case 7: sprintf (this->ChipID.ProcessorName,"i80486DX2 WriteBack"); break; - case 8: sprintf (this->ChipID.ProcessorName,"i80486DX4"); break; - case 9: sprintf (this->ChipID.ProcessorName,"i80486DX4 WriteBack"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown 80486 family"); return false; + case 0: this->ChipID.ProcessorName = "i80486DX-25/33"; break; + case 1: this->ChipID.ProcessorName = "i80486DX-50"; break; + case 2: this->ChipID.ProcessorName = "i80486SX"; break; + case 3: this->ChipID.ProcessorName = "i80486DX2"; break; + case 4: this->ChipID.ProcessorName = "i80486SL"; break; + case 5: this->ChipID.ProcessorName = "i80486SX2"; break; + case 7: this->ChipID.ProcessorName = "i80486DX2 WriteBack"; break; + case 8: this->ChipID.ProcessorName = "i80486DX4"; break; + case 9: this->ChipID.ProcessorName = "i80486DX4 WriteBack"; break; + default: this->ChipID.ProcessorName = "Unknown 80486 family"; return false; } break; case 5: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"P5 A-Step"); break; - case 1: sprintf (this->ChipID.ProcessorName,"P5"); break; - case 2: sprintf (this->ChipID.ProcessorName,"P54C"); break; - case 3: sprintf (this->ChipID.ProcessorName,"P24T OverDrive"); break; - case 4: sprintf (this->ChipID.ProcessorName,"P55C"); break; - case 7: sprintf (this->ChipID.ProcessorName,"P54C"); break; - case 8: sprintf (this->ChipID.ProcessorName,"P55C (0.25micron)"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Pentium family"); return false; + case 0: this->ChipID.ProcessorName = "P5 A-Step"; break; + case 1: this->ChipID.ProcessorName = "P5"; break; + case 2: this->ChipID.ProcessorName = "P54C"; break; + case 3: this->ChipID.ProcessorName = "P24T OverDrive"; break; + case 4: this->ChipID.ProcessorName = "P55C"; break; + case 7: this->ChipID.ProcessorName = "P54C"; break; + case 8: this->ChipID.ProcessorName = "P55C (0.25micron)"; break; + default: this->ChipID.ProcessorName = "Unknown Pentium family"; return false; } break; case 6: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"P6 A-Step"); break; - case 1: sprintf (this->ChipID.ProcessorName,"P6"); break; - case 3: sprintf (this->ChipID.ProcessorName,"Pentium II (0.28 micron)"); break; - case 5: sprintf (this->ChipID.ProcessorName,"Pentium II (0.25 micron)"); break; - case 6: sprintf (this->ChipID.ProcessorName,"Pentium II With On-Die L2 Cache"); break; - case 7: sprintf (this->ChipID.ProcessorName,"Pentium III (0.25 micron)"); break; - case 8: sprintf (this->ChipID.ProcessorName,"Pentium III (0.18 micron) With 256 KB On-Die L2 Cache "); break; - case 0xa: sprintf (this->ChipID.ProcessorName,"Pentium III (0.18 micron) With 1 Or 2 MB On-Die L2 Cache "); break; - case 0xb: sprintf (this->ChipID.ProcessorName,"Pentium III (0.13 micron) With 256 Or 512 KB On-Die L2 Cache "); break; - case 23: sprintf (this->ChipID.ProcessorName, "Intel(R) Core(TM)2 Duo CPU T9500 @ 2.60GHz"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown P6 family"); return false; + case 0: this->ChipID.ProcessorName = "P6 A-Step"; break; + case 1: this->ChipID.ProcessorName = "P6"; break; + case 3: this->ChipID.ProcessorName = "Pentium II (0.28 micron)"; break; + case 5: this->ChipID.ProcessorName = "Pentium II (0.25 micron)"; break; + case 6: this->ChipID.ProcessorName = "Pentium II With On-Die L2 Cache"; break; + case 7: this->ChipID.ProcessorName = "Pentium III (0.25 micron)"; break; + case 8: this->ChipID.ProcessorName = "Pentium III (0.18 micron) With 256 KB On-Die L2 Cache "; break; + case 0xa: this->ChipID.ProcessorName = "Pentium III (0.18 micron) With 1 Or 2 MB On-Die L2 Cache "; break; + case 0xb: this->ChipID.ProcessorName = "Pentium III (0.13 micron) With 256 Or 512 KB On-Die L2 Cache "; break; + case 23: this->ChipID.ProcessorName = "Intel(R) Core(TM)2 Duo CPU T9500 @ 2.60GHz"; break; + default: this->ChipID.ProcessorName = "Unknown P6 family"; return false; } break; case 7: - sprintf (this->ChipID.ProcessorName,"Intel Merced (IA-64)"); + this->ChipID.ProcessorName = "Intel Merced (IA-64)"; break; case 0xf: // Check the extended family bits... @@ -2054,21 +2044,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 0: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.18 micron)"); break; - case 1: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.18 micron)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"Pentium IV (0.13 micron)"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Pentium 4 family"); return false; + case 0: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break; + case 1: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break; + case 2: this->ChipID.ProcessorName = "Pentium IV (0.13 micron)"; break; + default: this->ChipID.ProcessorName = "Unknown Pentium 4 family"; return false; } break; case 1: - sprintf (this->ChipID.ProcessorName,"Intel McKinley (IA-64)"); + this->ChipID.ProcessorName = "Intel McKinley (IA-64)"; break; default: - sprintf (this->ChipID.ProcessorName,"Pentium"); + this->ChipID.ProcessorName = "Pentium"; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown Intel family"); + this->ChipID.ProcessorName = "Unknown Intel family"; return false; } break; @@ -2080,49 +2070,49 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 4: switch (this->ChipID.Model) { - case 3: sprintf (this->ChipID.ProcessorName,"80486DX2"); break; - case 7: sprintf (this->ChipID.ProcessorName,"80486DX2 WriteBack"); break; - case 8: sprintf (this->ChipID.ProcessorName,"80486DX4"); break; - case 9: sprintf (this->ChipID.ProcessorName,"80486DX4 WriteBack"); break; - case 0xe: sprintf (this->ChipID.ProcessorName,"5x86"); break; - case 0xf: sprintf (this->ChipID.ProcessorName,"5x86WB"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown 80486 family"); return false; + case 3: this->ChipID.ProcessorName = "80486DX2"; break; + case 7: this->ChipID.ProcessorName = "80486DX2 WriteBack"; break; + case 8: this->ChipID.ProcessorName = "80486DX4"; break; + case 9: this->ChipID.ProcessorName = "80486DX4 WriteBack"; break; + case 0xe: this->ChipID.ProcessorName = "5x86"; break; + case 0xf: this->ChipID.ProcessorName = "5x86WB"; break; + default: this->ChipID.ProcessorName = "Unknown 80486 family"; return false; } break; case 5: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"SSA5 (PR75, PR90, PR100)"); break; - case 1: sprintf (this->ChipID.ProcessorName,"5k86 (PR120, PR133)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"5k86 (PR166)"); break; - case 3: sprintf (this->ChipID.ProcessorName,"5k86 (PR200)"); break; - case 6: sprintf (this->ChipID.ProcessorName,"K6 (0.30 micron)"); break; - case 7: sprintf (this->ChipID.ProcessorName,"K6 (0.25 micron)"); break; - case 8: sprintf (this->ChipID.ProcessorName,"K6-2"); break; - case 9: sprintf (this->ChipID.ProcessorName,"K6-III"); break; - case 0xd: sprintf (this->ChipID.ProcessorName,"K6-2+ or K6-III+ (0.18 micron)"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown 80586 family"); return false; + case 0: this->ChipID.ProcessorName = "SSA5 (PR75, PR90 = PR100)"; break; + case 1: this->ChipID.ProcessorName = "5k86 (PR120 = PR133)"; break; + case 2: this->ChipID.ProcessorName = "5k86 (PR166)"; break; + case 3: this->ChipID.ProcessorName = "5k86 (PR200)"; break; + case 6: this->ChipID.ProcessorName = "K6 (0.30 micron)"; break; + case 7: this->ChipID.ProcessorName = "K6 (0.25 micron)"; break; + case 8: this->ChipID.ProcessorName = "K6-2"; break; + case 9: this->ChipID.ProcessorName = "K6-III"; break; + case 0xd: this->ChipID.ProcessorName = "K6-2+ or K6-III+ (0.18 micron)"; break; + default: this->ChipID.ProcessorName = "Unknown 80586 family"; return false; } break; case 6: switch (this->ChipID.Model) { - case 1: sprintf (this->ChipID.ProcessorName,"Athlon- (0.25 micron)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"Athlon- (0.18 micron)"); break; - case 3: sprintf (this->ChipID.ProcessorName,"Duron- (SF core)"); break; - case 4: sprintf (this->ChipID.ProcessorName,"Athlon- (Thunderbird core)"); break; - case 6: sprintf (this->ChipID.ProcessorName,"Athlon- (Palomino core)"); break; - case 7: sprintf (this->ChipID.ProcessorName,"Duron- (Morgan core)"); break; + case 1: this->ChipID.ProcessorName = "Athlon- (0.25 micron)"; break; + case 2: this->ChipID.ProcessorName = "Athlon- (0.18 micron)"; break; + case 3: this->ChipID.ProcessorName = "Duron- (SF core)"; break; + case 4: this->ChipID.ProcessorName = "Athlon- (Thunderbird core)"; break; + case 6: this->ChipID.ProcessorName = "Athlon- (Palomino core)"; break; + case 7: this->ChipID.ProcessorName = "Duron- (Morgan core)"; break; case 8: if (this->Features.ExtendedFeatures.SupportsMP) - sprintf (this->ChipID.ProcessorName,"Athlon - MP (Thoroughbred core)"); - else sprintf (this->ChipID.ProcessorName,"Athlon - XP (Thoroughbred core)"); + this->ChipID.ProcessorName = "Athlon - MP (Thoroughbred core)"; + else this->ChipID.ProcessorName = "Athlon - XP (Thoroughbred core)"; break; - default: sprintf (this->ChipID.ProcessorName,"Unknown K7 family"); return false; + default: this->ChipID.ProcessorName = "Unknown K7 family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown AMD family"); + this->ChipID.ProcessorName = "Unknown AMD family"; return false; } break; @@ -2133,12 +2123,12 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 5: switch (this->ChipID.Model) { - case 4: sprintf (this->ChipID.ProcessorName,"Crusoe TM3x00 and TM5x00"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Crusoe family"); return false; + case 4: this->ChipID.ProcessorName = "Crusoe TM3x00 and TM5x00"; break; + default: this->ChipID.ProcessorName = "Unknown Crusoe family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown Transmeta family"); + this->ChipID.ProcessorName = "Unknown Transmeta family"; return false; } break; @@ -2149,13 +2139,13 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 5: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"mP6 (0.25 micron)"); break; - case 2: sprintf (this->ChipID.ProcessorName,"mP6 (0.18 micron)"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Rise family"); return false; + case 0: this->ChipID.ProcessorName = "mP6 (0.25 micron)"; break; + case 2: this->ChipID.ProcessorName = "mP6 (0.18 micron)"; break; + default: this->ChipID.ProcessorName = "Unknown Rise family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown Rise family"); + this->ChipID.ProcessorName = "Unknown Rise family"; return false; } break; @@ -2166,13 +2156,13 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 4: switch (this->ChipID.Model) { - case 1: sprintf (this->ChipID.ProcessorName,"U5D"); break; - case 2: sprintf (this->ChipID.ProcessorName,"U5S"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown UMC family"); return false; + case 1: this->ChipID.ProcessorName = "U5D"; break; + case 2: this->ChipID.ProcessorName = "U5S"; break; + default: this->ChipID.ProcessorName = "Unknown UMC family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown UMC family"); + this->ChipID.ProcessorName = "Unknown UMC family"; return false; } break; @@ -2183,21 +2173,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 5: switch (this->ChipID.Model) { - case 4: sprintf (this->ChipID.ProcessorName,"C6"); break; - case 8: sprintf (this->ChipID.ProcessorName,"C2"); break; - case 9: sprintf (this->ChipID.ProcessorName,"C3"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family"); return false; + case 4: this->ChipID.ProcessorName = "C6"; break; + case 8: this->ChipID.ProcessorName = "C2"; break; + case 9: this->ChipID.ProcessorName = "C3"; break; + default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false; } break; case 6: switch (this->ChipID.Model) { - case 6: sprintf (this->ChipID.ProcessorName,"VIA Cyrix III - Samuel"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family"); return false; + case 6: this->ChipID.ProcessorName = "VIA Cyrix III - Samuel"; break; + default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown IDT\\Centaur family"); + this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false; } break; @@ -2208,32 +2198,32 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 4: switch (this->ChipID.Model) { - case 4: sprintf (this->ChipID.ProcessorName,"MediaGX GX, GXm"); break; - case 9: sprintf (this->ChipID.ProcessorName,"5x86"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Cx5x86 family"); return false; + case 4: this->ChipID.ProcessorName = "MediaGX GX = GXm"; break; + case 9: this->ChipID.ProcessorName = "5x86"; break; + default: this->ChipID.ProcessorName = "Unknown Cx5x86 family"; return false; } break; case 5: switch (this->ChipID.Model) { - case 2: sprintf (this->ChipID.ProcessorName,"Cx6x86"); break; - case 4: sprintf (this->ChipID.ProcessorName,"MediaGX GXm"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown Cx6x86 family"); return false; + case 2: this->ChipID.ProcessorName = "Cx6x86"; break; + case 4: this->ChipID.ProcessorName = "MediaGX GXm"; break; + default: this->ChipID.ProcessorName = "Unknown Cx6x86 family"; return false; } break; case 6: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"6x86MX"); break; - case 5: sprintf (this->ChipID.ProcessorName,"Cyrix M2 Core"); break; - case 6: sprintf (this->ChipID.ProcessorName,"WinChip C5A Core"); break; - case 7: sprintf (this->ChipID.ProcessorName,"WinChip C5B\\C5C Core"); break; - case 8: sprintf (this->ChipID.ProcessorName,"WinChip C5C-T Core"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown 6x86MX\\Cyrix III family"); return false; + case 0: this->ChipID.ProcessorName = "6x86MX"; break; + case 5: this->ChipID.ProcessorName = "Cyrix M2 Core"; break; + case 6: this->ChipID.ProcessorName = "WinChip C5A Core"; break; + case 7: this->ChipID.ProcessorName = "WinChip C5B\\C5C Core"; break; + case 8: this->ChipID.ProcessorName = "WinChip C5C-T Core"; break; + default: this->ChipID.ProcessorName = "Unknown 6x86MX\\Cyrix III family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown Cyrix family"); + this->ChipID.ProcessorName = "Unknown Cyrix family"; return false; } break; @@ -2244,21 +2234,21 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() case 5: switch (this->ChipID.Model) { - case 0: sprintf (this->ChipID.ProcessorName,"Nx586 or Nx586FPU"); break; - default: sprintf (this->ChipID.ProcessorName,"Unknown NexGen family"); return false; + case 0: this->ChipID.ProcessorName = "Nx586 or Nx586FPU"; break; + default: this->ChipID.ProcessorName = "Unknown NexGen family"; return false; } break; default: - sprintf (this->ChipID.ProcessorName,"Unknown NexGen family"); + this->ChipID.ProcessorName = "Unknown NexGen family"; return false; } break; case NSC: - sprintf (this->ChipID.ProcessorName,"Cx486SLC \\ DLC \\ Cx486S A-Step"); + this->ChipID.ProcessorName = "Cx486SLC \\ DLC \\ Cx486S A-Step"; break; default: - sprintf (this->ChipID.ProcessorName,"Unknown family"); // We cannot identify the processor. + this->ChipID.ProcessorName = "Unknown family"; // We cannot identify the processor. return false; } @@ -2365,7 +2355,7 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() this->ChipID.Family = atoi(this->ExtractValueFromCpuInfoFile(buffer,"cpu family").c_str()); // Chip Vendor - strcpy(this->ChipID.Vendor,this->ExtractValueFromCpuInfoFile(buffer,"vendor_id").c_str()); + this->ChipID.Vendor = this->ExtractValueFromCpuInfoFile(buffer,"vendor_id"); this->FindManufacturer(); // Chip Model @@ -2964,7 +2954,7 @@ bool SystemInformationImplementation::ParseSysCtl() kwsys_stl::string machineBuf(retBuf); if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos) { - strcpy(this->ChipID.Vendor, "IBM"); + this->ChipID.Vendor = "IBM"; len = 4; err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len, NULL, 0); err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len, NULL, 0); @@ -2982,13 +2972,14 @@ bool SystemInformationImplementation::ParseSysCtl() len = 128; err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, NULL, 0); // Chip Vendor - strcpy(this->ChipID.Vendor,retBuf); + this->ChipID.Vendor = retBuf; this->FindManufacturer(); - len=CHIPNAME_STRING_LENGTH; + ::memset(retBuf, 0, 128); err = sysctlbyname("machdep.cpu.brand_string", - this->ChipID.ProcessorName, &len, NULL, 0); + retBuf, &len, NULL, 0); + this->ChipID.ProcessorName = retBuf; // Chip Model len = sizeof(value); @@ -3175,11 +3166,11 @@ bool SystemInformationImplementation::QuerySolarisInfo() this->ChipID.Family = 0; // Chip Vendor - strcpy(this->ChipID.Vendor,"Sun"); + this->ChipID.Vendor = "Sun"; this->FindManufacturer(); // Chip Model - sprintf(this->ChipID.ProcessorName,"%s",this->ParseValueFromKStat("-s cpu_type").c_str()); + this->ChipID.ProcessorName = this->ParseValueFromKStat("-s cpu_type"); this->ChipID.Model = 0; // Cache size @@ -3233,7 +3224,7 @@ bool SystemInformationImplementation::QueryHaikuInfo() char vbuf[13]; strncpy(vbuf, cpu_info.eax_0.vendor_id, 12); vbuf[12] = '\0'; - strcpy(this->ChipID.Vendor,vbuf); + this->ChipID.Vendor = vbuf; this->FindManufacturer(); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 8aa99eb..60d6869 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -378,9 +378,7 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start); if(endpos != kwsys_stl::string::npos) { - kwsys_stl::string convertedPath; - Realpath(pathEnv.substr(start, endpos-start).c_str(), convertedPath); - path.push_back(convertedPath); + path.push_back(pathEnv.substr(start, endpos-start)); start = endpos+1; } else @@ -1642,7 +1640,7 @@ kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path) kwsys_stl::string ret = path; // remove // except at the beginning might be a cygwin drive - kwsys_stl::string::size_type pos=0; + kwsys_stl::string::size_type pos=1; while((pos = ret.find("//", pos)) != kwsys_stl::string::npos) { ret.erase(pos, 1); diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index fef2d01..433a86f 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 12) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 06) +SET(KWSYS_DATE_STAMP_DAY 21) diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index ad35c34..c0e74af 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -297,7 +297,7 @@ bool CheckStringOperations() if (kwsys::SystemTools::ConvertToUnixOutputPath ("//Local Mojo/Hex Power Pack/Iffy Voodoo") != - "/Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo") + "//Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo") { kwsys_ios::cerr << "Problem with ConvertToUnixOutputPath " diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 04f0774..7409b0b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -486,6 +486,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK}) set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK}) + set(CTEST_RUN_CPackComponentsForAll ${CTEST_TEST_CPACK}) find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS] @@ -534,6 +535,34 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents") ENDIF(CTEST_RUN_CPackComponents) + IF(CTEST_RUN_CPackComponentsForAll) + set(CPackComponentsForAll_EXTRA_OPTIONS) + + set(CPackRun_CPackGen "-DCPackGen=ZIP") + set(CPackRun_CPackCommand "-DCPackCommand=${CMAKE_CPACK_COMMAND}") + set(CPackRun_CPackComponentWay "-DCPackComponentWay=default") + + ADD_TEST(CPackComponentsForAll-ZIP-default ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll" + "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project CPackComponentsForAll + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-options + -DCPACK_BINARY_ZIP:BOOL=ON + ${CPackComponentsForAll_EXTRA_OPTIONS} + --graphviz=CPackComponentsForAll.dot + --test-command ${CMAKE_CMAKE_COMMAND} + "-DCPackComponentsForAll_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponentsForAll/buildZIP-NoComponent" + "${CPackRun_CPackCommand}" + "${CPackRun_CPackGen}" + "${CPackRun_CPackComponentWay}" + -P "${CMake_SOURCE_DIR}/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake") + + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponentsForAll") + ENDIF(CTEST_RUN_CPackComponentsForAll) + # By default, turn this test off (because it takes a long time...) # if(NOT DEFINED CTEST_RUN_CPackTestAllGenerators) @@ -779,6 +808,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} ) + SET_TESTS_PROPERTIES(testing PROPERTIES PASS_REGULAR_EXPRESSION "Passed") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Testing") ADD_TEST(wrapping ${CMAKE_CTEST_COMMAND} diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index 0ab2a67..3fb4652 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -77,6 +77,13 @@ set(linux64_pgf90_libs "pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;nspgc;pgc;rt;p set(linux64_pgf90_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2") list(APPEND platforms linux64_pgf90) +# nagfor dummy.f -Wl,-v +set(linux64_nagfor_text " /usr/libexec/gcc/x86_64-redhat-linux/4.4.5/collect2 --no-add-needed --eh-frame-hdr --build-id -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../.. /usr/local/NAG/lib/f90_init.o /usr/local/NAG/lib/quickfit.o dummy.o -rpath /usr/local/NAG/lib /usr/local/NAG/lib/libf53.so /usr/local/NAG/lib/libf53.a -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crtn.o") +set(linux64_nagfor_libs "/usr/local/NAG/lib/f90_init.o;/usr/local/NAG/lib/quickfit.o;/usr/local/NAG/lib/libf53.a;m;c") +set(linux64_nagfor_dirs "/usr/lib/gcc/x86_64-redhat-linux/4.4.5;/usr/lib64;/lib64;/usr/lib") +set(linux64_nagfor_obj_regex "^/usr/local/NAG/lib") +list(APPEND platforms linux64_nagfor) + # gcc dummy.c -v # in strange path set(linux64_test1_text " /this/might/match/as/a/linker/ld/but/it/is/not because the ld is not the last path component @@ -380,7 +387,7 @@ list(APPEND platforms msys_g77) # Test parsing for all above examples. foreach(p IN LISTS platforms) - cmake_parse_implicit_link_info("${${p}_text}" libs dirs log) + cmake_parse_implicit_link_info("${${p}_text}" libs dirs log "${${p}_obj_regex}") foreach(v libs dirs) if(NOT "${${v}}" STREQUAL "${${p}_${v}}") diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt new file mode 100644 index 0000000..971b2dc --- /dev/null +++ b/Tests/CPackComponentsForAll/CMakeLists.txt @@ -0,0 +1,120 @@ +# CPack Example: User-selectable Installation Components +# +# In this example, we have a simple library (mylib) with an example +# application (mylibapp). We create a binary installer (a CPack Generator) +# which supports CPack components. +# +# Depending on the CPack generator and on some CPACK_xxx var values +# the generator may produce a single (NSIS, PackageMaker) +# or several package files (Archive Generators, RPM, DEB) +cmake_minimum_required(VERSION 2.8.3.20101130 FATAL_ERROR) +project(CPackComponentsForAll) + +# Create the mylib library +add_library(mylib mylib.cpp) + +# Create the mylibapp application +add_executable(mylibapp mylibapp.cpp) +target_link_libraries(mylibapp mylib) + +# Duplicate of mylibapp application +# which won't be put in any component (?mistake?) +add_executable(mylibapp2 mylibapp.cpp) +target_link_libraries(mylibapp2 mylib) + +# Create installation targets. Note that we put each kind of file +# into a different component via COMPONENT. These components will +# be used to create the installation components. +install(TARGETS mylib + ARCHIVE + DESTINATION lib + COMPONENT libraries) +install(TARGETS mylibapp + RUNTIME + DESTINATION bin + COMPONENT applications) + +# This application does not belong to any component +# thus (as of cmake 2.8.2) it will be left "uninstalled" +# by a component-aware installer unless a +# CPACK_MONOLITHIC_INSTALL=1 is set (at cmake time). +install(TARGETS mylibapp2 + RUNTIME + DESTINATION bin) + +install(FILES mylib.h + DESTINATION include + COMPONENT headers) + +# CPack boilerplate for this project +set(CPACK_PACKAGE_NAME "MyLib") +set(CPACK_PACKAGE_CONTACT "None") +set(CPACK_PACKAGE_VENDOR "CMake.org") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example") +set(CPACK_PACKAGE_VERSION "1.0.2") +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "2") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") + +# Tell CPack all of the components to install. The "ALL" +# refers to the fact that this is the set of components that +# will be included when CPack is instructed to put everything +# into the binary installer (the default behavior). +set(CPACK_COMPONENTS_ALL applications libraries headers Unspecified) + +# Set the displayed names for each of the components to install. +# These will be displayed in the list of components inside the installer. +set(CPACK_COMPONENT_APPLICATIONS_DISPLAY_NAME "MyLib Application") +set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers") + +# Provide descriptions for each of the components to install. +# When the user hovers the mouse over the name of a component, +# the description will be shown in the "Description" box in the +# installer. If no descriptions are provided, the "Description" +# box will be removed. +set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION + "An extremely useful application that makes use of MyLib") +set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "Static libraries used to build programs with MyLib") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "C/C++ header files for use with MyLib") + +# Put the components into two different groups: "Runtime" and "Development" +set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime") +set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") +set(CPACK_COMPONENT_HEADERS_GROUP "Development") + +# Expand the "Development" group by default, since we have so few components. +# Also, provide this group with a description. +set(CPACK_COMPONENT_GROUP_DEVELOPMENT_EXPANDED ON) +set(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION + "All of the tools you'll ever need to develop software") + +# It doesn't make sense to install the headers without the libraries +# (because you could never use the headers!), so make the headers component +# depend on the libraries component. +set(CPACK_COMPONENT_HEADERS_DEPENDS libraries) + +# Create two installation types with pre-selected components. +# The "Developer" installation has just the library and headers, +# while the "Full" installation has everything. +set(CPACK_ALL_INSTALL_TYPES Full Developer) +set(CPACK_INSTALL_TYPE_FULL_DISPLAY_NAME "Everything") +set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full) +set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full) +set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full) + +# We may use the CPack specific config file in order +# to tailor CPack behavio on a CPack generator specific way +# (Behavior would be different for RPM or TGZ or DEB ...) +if (USE_CPACK_PROJECT_CONFIG) + # Setup project specific CPack-time CPack Config file. + configure_file(${MyLib_SOURCE_DIR}/MyLibCPackConfig.cmake.in + ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake + @ONLY) + set(CPACK_PROJECT_CONFIG_FILE ${MyLib_BINARY_DIR}/MyLibCPackConfig.cmake) +endif (USE_CPACK_PROJECT_CONFIG) +# Include CPack to introduce the appropriate targets +include(CPack)
\ No newline at end of file diff --git a/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in new file mode 100644 index 0000000..7ffafae --- /dev/null +++ b/Tests/CPackComponentsForAll/MyLibCPackConfig.cmake.in @@ -0,0 +1,7 @@ +if(CPACK_GENERATOR MATCHES "ZIP") +# set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) +endif(CPACK_GENERATOR MATCHES "ZIP") + +if(CPACK_GENERATOR MATCHES "TGZ") + set(CPACK_MONOLITHIC_INSTALL 1) +endif(CPACK_GENERATOR MATCHES "TGZ") diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake new file mode 100644 index 0000000..11f72ec --- /dev/null +++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake @@ -0,0 +1,73 @@ +message(STATUS "=============================================================================") +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message(STATUS "") + +if(NOT CPackComponentsForAll_BINARY_DIR) + message(FATAL_ERROR "CPackComponentsForAll_BINARY_DIR not set") +endif(NOT CPackComponentsForAll_BINARY_DIR) + +if(NOT CPackGen) + message(FATAL_ERROR "CPackGen not set") +endif(NOT CPackGen) +get_filename_component(CPACK_LOCATION ${CMAKE_COMMAND} PATH) +set(CPackCommand "${CPACK_LOCATION}/cpack") +message("cpack = ${CPackCommand}") +if(NOT CPackCommand) + message(FATAL_ERROR "CPackCommand not set") +endif(NOT CPackCommand) + +if(NOT CPackComponentWay) + message(FATAL_ERROR "CPackComponentWay not set") +endif(NOT CPackComponentWay) + +set(expected_file_mask "") +# The usual default behavior is to expect a single file +# Then some specific generators (Archive, RPM, ...) +# May produce several numbers of files depending on +# CPACK_COMPONENT_xxx values +set(expected_count 1) +set(config_type $ENV{CMAKE_CONFIG_TYPE}) +set(config_args ) +if(config_type) + set(config_args -C ${config_type}) +endif() +message(" ${config_args}") +execute_process(COMMAND ${CPackCommand} -G ${CPackGen} ${config_args} + RESULT_VARIABLE CPack_result + OUTPUT_VARIABLE CPack_output + ERROR_VARIABLE CPack_error + WORKING_DIRECTORY ${CPackComponentsForAll_BINARY_DIR}) + +if (CPack_result) + message(FATAL_ERROR "error: CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") +else (CPack_result) + message(STATUS "CPack_output=${CPack_output}") +endif(CPack_result) + +if(CPackGen MATCHES "ZIP") + set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/MyLib-*.zip") + if (${CPackComponentWay} STREQUAL "default") + set(expected_count 1) + endif(${CPackComponentWay} STREQUAL "default") +endif(CPackGen MATCHES "ZIP") + +# Now verify if the number of expected file is OK +# - using expected_file_mask and +# - expected_count +if(expected_file_mask) + file(GLOB expected_file "${expected_file_mask}") + + message(STATUS "expected_count='${expected_count}'") + message(STATUS "expected_file='${expected_file}'") + message(STATUS "expected_file_mask='${expected_file_mask}'") + + if(NOT expected_file) + message(FATAL_ERROR "error: expected_file=${expected_file} does not exist: CPackComponentsForAll test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}") + endif(NOT expected_file) + + list(LENGTH expected_file actual_count) + message(STATUS "actual_count='${actual_count}'") + if(NOT actual_count EQUAL expected_count) + message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})") + endif(NOT actual_count EQUAL expected_count) +endif(expected_file_mask) diff --git a/Tests/CPackComponentsForAll/mylib.cpp b/Tests/CPackComponentsForAll/mylib.cpp new file mode 100644 index 0000000..8ddac19 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylib.cpp @@ -0,0 +1,7 @@ +#include "mylib.h" +#include "stdio.h" + +void mylib_function() +{ + printf("This is mylib"); +} diff --git a/Tests/CPackComponentsForAll/mylib.h b/Tests/CPackComponentsForAll/mylib.h new file mode 100644 index 0000000..5d0a822 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylib.h @@ -0,0 +1 @@ +void mylib_function(); diff --git a/Tests/CPackComponentsForAll/mylibapp.cpp b/Tests/CPackComponentsForAll/mylibapp.cpp new file mode 100644 index 0000000..a438ac7 --- /dev/null +++ b/Tests/CPackComponentsForAll/mylibapp.cpp @@ -0,0 +1,6 @@ +#include "mylib.h" + +int main() +{ + mylib_function(); +} diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 98b29bb..08cc7d4 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -49,10 +49,17 @@ LINK_LIBRARIES(${COMPLEX_LIBS}) SET_SOURCE_FILES_PROPERTIES(complex_nobuild.cxx PROPERTIES HEADER_FILE_ONLY 1) +# Test forcing a .c file to not build. +# This makes sure a mixed language library is created +# with header file only sources +SET_SOURCE_FILES_PROPERTIES(complex_nobuild.c PROPERTIES + HEADER_FILE_ONLY 1) + ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt) ADD_EXECUTABLE(complex complex testcflags.c ) # Sub1/NameConflictTest.c Sub2/NameConflictTest.c) -ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx) +ADD_EXECUTABLE(complex.file complex.file.cxx complex_nobuild.cxx + complex_nobuild.c) IF(COMPLEX_TEST_CMAKELIB) TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmlibarchive cmbzip2 cmcurl) ENDIF(COMPLEX_TEST_CMAKELIB) diff --git a/Tests/Complex/Executable/complex_nobuild.c b/Tests/Complex/Executable/complex_nobuild.c new file mode 100644 index 0000000..6b3c2c1 --- /dev/null +++ b/Tests/Complex/Executable/complex_nobuild.c @@ -0,0 +1 @@ +#error "This file should not be compiled." diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 6a86a34..19e3c2c 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -55,7 +55,7 @@ ADD_CUSTOM_COMMAND( # Test creating files from a custom target # ################################################################ -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/doc1.dvi +ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}//doc1.dvi # test 2 slashes DEPENDS ${PROJECT_SOURCE_DIR}/doc1.tex COMMAND ${CMAKE_COMMAND} ARGS -E copy ${PROJECT_SOURCE_DIR}/doc1.tex diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index 2e052bf..7792a35 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -256,3 +256,27 @@ endif() if(NOT "${var_b}" STREQUAL "x") message(FATAL_ERROR "count incorrect \"b\": [${var_b}]") endif() + +# Test SUBSTRING command +SET(ST_INPUTSTRING "0123456789") +STRING(SUBSTRING ${ST_INPUTSTRING} 3 0 ST_EMPTY) +STRING(SUBSTRING ${ST_INPUTSTRING} 1 1 ST_ONE) +STRING(SUBSTRING ${ST_INPUTSTRING} 0 10 ST_ALL) +STRING(SUBSTRING ${ST_INPUTSTRING} 0 -1 ST_ALL_MINUS) +STRING(SUBSTRING ${ST_INPUTSTRING} 9 -1 ST_NINE) + +IF(ST_EMPTY) + MESSAGE(SEND_ERROR "SUBSTRING with length 0 does not return an empty string") +ENDIF(ST_EMPTY) +IF(NOT ST_ONE STREQUAL "1") + MESSAGE(SEND_ERROR "SUBSTING command does not cut the correct selected character, was \"" ${ST_ONE} "\", should be \"1\"") +ENDIF(NOT ST_ONE STREQUAL "1") +IF(NOT ST_INPUTSTRING STREQUAL ST_ALL) + MESSAGE(SEND_ERROR "SUBSTRING does not return the whole string when selected with length") +ENDIF(NOT ST_INPUTSTRING STREQUAL ST_ALL) +IF(NOT ST_INPUTSTRING STREQUAL ST_ALL_MINUS) + MESSAGE(SEND_ERROR "SUBSTRING does not return the whole string when selected with -1") +ENDIF(NOT ST_INPUTSTRING STREQUAL ST_ALL_MINUS) +IF(NOT ST_NINE STREQUAL "9") + MESSAGE(SEND_ERROR "SUBSTRING does not return the tail when selected with -1") +ENDIF(NOT ST_NINE STREQUAL "9") diff --git a/Tests/Testing/Sub/Sub2/CMakeLists.txt b/Tests/Testing/Sub/Sub2/CMakeLists.txt index 3a7295d..fb9e861 100644 --- a/Tests/Testing/Sub/Sub2/CMakeLists.txt +++ b/Tests/Testing/Sub/Sub2/CMakeLists.txt @@ -3,3 +3,15 @@ # ADD_EXECUTABLE(testing2 testing2.cxx) ADD_TEST(testing.2 ${Testing_BINARY_DIR}/bin/testing2) + +add_test(NotCycle.a ${CMAKE_COMMAND} -E echo a) +add_test(NotCycle.test1 ${CMAKE_COMMAND} -E echo test1) +set_property(TEST NotCycle.test1 PROPERTY DEPENDS NotCycle.a) + +add_test(NotCycle.b ${CMAKE_COMMAND} -E echo b) +add_test(NotCycle.test2 ${CMAKE_COMMAND} -E echo test2) +set_property(TEST NotCycle.test2 PROPERTY DEPENDS NotCycle.b NotCycle.test1) + +add_test(NotCycle.c ${CMAKE_COMMAND} -E echo c) +add_test(NotCycle.test3 ${CMAKE_COMMAND} -E echo test3) +set_property(TEST NotCycle.test3 PROPERTY DEPENDS NotCycle.c NotCycle.test1 NotCycle.test2) diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index a57498f..90c2cfc 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -226,3 +226,9 @@ UNSET(CXX_BOGUS_FLAG CACHE) INCLUDE(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG(${CXX_DD}-_this_is_not_a_flag_ CXX_BOGUS_FLAG) TEST_FAIL(CXX_BOGUS_FLAG "CHECK_CXX_COMPILER_FLAG() succeeded, but should have failed") + +IF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + UNSET(C_STRICT_PROTOTYPES CACHE) + CHECK_C_COMPILER_FLAG("-Werror;-Wstrict-prototypes" C_STRICT_PROTOTYPES) + TEST_ASSERT(C_STRICT_PROTOTYPES "CHECK_C_COMPILER_FLAG failed -Werror -Wstrict-prototypes") +ENDIF() diff --git a/Utilities/Release/Cygwin/CMakeLists.txt b/Utilities/Release/Cygwin/CMakeLists.txt index 0c274f3..2420c97 100644 --- a/Utilities/Release/Cygwin/CMakeLists.txt +++ b/Utilities/Release/Cygwin/CMakeLists.txt @@ -1,8 +1,8 @@ -FILE(GLOB INSTALLED_CURSES /usr/bin/cygncurses*.dll) +FILE(GLOB INSTALLED_CURSES /usr/bin/cygncurses-*.dll) SET(MAX 0) FOREACH(f ${INSTALLED_CURSES}) IF(NOT "${f}" MATCHES "\\+") - STRING(REGEX REPLACE ".*([0-9]).dll" "\\1" NUMBER "${f}") + STRING(REGEX REPLACE ".*-([0-9]*).dll" "\\1" NUMBER "${f}") IF(NUMBER GREATER MAX) SET(MAX ${NUMBER}) ENDIF(NUMBER GREATER MAX) diff --git a/Utilities/cmcurl/CMake/OtherTests.cmake b/Utilities/cmcurl/CMake/OtherTests.cmake index ea1613d..7d2c66f 100644 --- a/Utilities/cmcurl/CMake/OtherTests.cmake +++ b/Utilities/cmcurl/CMake/OtherTests.cmake @@ -193,14 +193,6 @@ SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") CURL_CHECK_C_SOURCE_COMPILES("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL) -INCLUDE(CurlCheckCSourceRuns) -SET(EXTRA_DEFINES) -SET(HEADER_INCLUDES) -IF(HAVE_SYS_POLL_H) - SET(HEADER_INCLUDES "sys/poll.h") -ENDIF(HAVE_SYS_POLL_H) -CURL_CHECK_C_SOURCE_RUNS("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE) - SET(HAVE_SIG_ATOMIC_T 1) SET(EXTRA_DEFINES) SET(HEADER_INCLUDES) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 0f98e5a..454d2d1 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -521,42 +521,6 @@ MACRO(CURL_INTERNAL_TEST CURL_TEST) ENDIF("${CURL_TEST}" MATCHES "^${CURL_TEST}$") ENDMACRO(CURL_INTERNAL_TEST) -MACRO(CURL_INTERNAL_TEST_RUN CURL_TEST) - IF("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}") - IF(CMAKE_REQUIRED_LIBRARIES) - SET(CURL_TEST_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - ENDIF(CMAKE_REQUIRED_LIBRARIES) - - MESSAGE(STATUS "Performing Curl Test ${CURL_TEST}") - TRY_RUN(${CURL_TEST} ${CURL_TEST}_COMPILE - ${CMAKE_BINARY_DIR} - ${LIBCURL_SOURCE_DIR}/CMake/CurlTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${CURL_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT) - IF(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - SET(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") - MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Success") - ELSE(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Failed") - SET(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "Performing Curl Test ${CURL_TEST} failed with the following output:\n" - "${OUTPUT}") - IF(${CURL_TEST}_COMPILE) - FILE(APPEND - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "There was a running problem of this test\n") - ENDIF(${CURL_TEST}_COMPILE) - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "\n\n") - ENDIF(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - ENDIF("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") -ENDMACRO(CURL_INTERNAL_TEST_RUN) - # Do curl specific tests #OPTION(CURL_HAVE_DISABLED_NONBLOCKING "Disable non-blocking socket detection" OFF) SET(CURL_NONBLOCKING_TESTS) @@ -599,13 +563,6 @@ IF(HAVE_FILE_OFFSET_BITS) SET(_FILE_OFFSET_BITS 64) ENDIF(HAVE_FILE_OFFSET_BITS) -FOREACH(CURL_TEST - HAVE_GLIBC_STRERROR_R - HAVE_POSIX_STRERROR_R - ) - CURL_INTERNAL_TEST_RUN(${CURL_TEST}) -ENDFOREACH(CURL_TEST) - # Check for reentrant FOREACH(CURL_TEST HAVE_GETHOSTBYADDR_R_5 diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index e3efdc1..6e74935 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -171,9 +171,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine HAVE_GETTIMEOFDAY ${HAVE_GETTIMEOFDAY} -/* we have a glibc-style strerror_r() */ -#cmakedefine HAVE_GLIBC_STRERROR_R ${HAVE_GLIBC_STRERROR_R} - /* Define to 1 if you have the `gmtime_r' function. */ #cmakedefine HAVE_GMTIME_R ${HAVE_GMTIME_R} @@ -348,12 +345,6 @@ /* Define to 1 if you have the `poll' function. */ #cmakedefine HAVE_POLL ${HAVE_POLL} -/* If you have a fine poll */ -#cmakedefine HAVE_POLL_FINE ${HAVE_POLL_FINE} - -/* we have a POSIX-style strerror_r() */ -#cmakedefine HAVE_POSIX_STRERROR_R ${HAVE_POSIX_STRERROR_R} - /* Define to 1 if you have the <process.h> header file. */ #cmakedefine HAVE_PROCESS_H ${HAVE_PROCESS_H} @@ -444,9 +435,6 @@ /* Define to 1 if you have the `strdup' function. */ #cmakedefine HAVE_STRDUP ${HAVE_STRDUP} -/* Define to 1 if you have the `strerror_r' function. */ -#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} - /* Define to 1 if you have the `stricmp' function. */ #cmakedefine HAVE_STRICMP ${HAVE_STRICMP} diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c index d3967ed..51adbcf 100644 --- a/Utilities/cmcurl/select.c +++ b/Utilities/cmcurl/select.c @@ -78,7 +78,7 @@ */ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) { -#if defined(HAVE_POLL_FINE) || defined(CURL_HAVE_WSAPOLL) +#if (defined(HAVE_POLL) && !defined(_POLL_EMUL_H_)) || defined(CURL_HAVE_WSAPOLL) struct pollfd pfd[2]; int num; int r; @@ -96,7 +96,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) num++; } -#ifdef HAVE_POLL_FINE +#if defined(HAVE_POLL) && !defined(_POLL_EMUL_H_) do { r = poll(pfd, num, timeout_ms); } while((r == -1) && (errno == EINTR)); @@ -220,7 +220,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms) { int r; -#ifdef HAVE_POLL_FINE +#if defined(HAVE_POLL) && !defined(_POLL_EMUL_H_) do { r = poll(ufds, nfds, timeout_ms); } while((r == -1) && (errno == EINTR)); |