Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstallRequiredSystemLibraries fixes #1

Closed
wants to merge 3 commits into from
Closed

InstallRequiredSystemLibraries fixes #1

wants to merge 3 commits into from

Conversation

MikeMcQuaid
Copy link
Contributor

Patches to fix the following issues:
http://www.vtk.org/Bug/view.php?id=11127
http://www.vtk.org/Bug/view.php?id=11140
http://www.vtk.org/Bug/view.php?id=11141

I'm aware I may need to create tests for these, asking for advice by email. Let me know of any other changes needed and I'll update ASAP.

In InstallRequiredSystemLibraries the documentation details the
variable CMAKE_SKIP_INSTALL_RULES to skip installation. This
actually doesn't do anything, the variable required is named
CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP. This commit amends the
documentation to point to the correct variable.
InstallRequiredSystemLibraries currently defaults to installing to
bin on WIN32 and lib otherwise. This patch allows you to configure
this by using the variable CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION.

It also switches the logic to use a single INSTALL(PROGRAMS) command
rather than two deprecated uses of the INSTALL_PROGRAMS command.
Add support to InstallRequiredSystemLibraries to only install
debug libraries when both debug and release versions are available.

This is as if you are building a debug package then only the debug
versions are needed but not the release.
@MikeMcQuaid
Copy link
Contributor Author

Seems to be merged, thanks!

hjmjohnson added a commit to hjmjohnson/CMake that referenced this pull request Jun 30, 2012
Separate lower case conversion for build.

This changes all the CMake key words to lower case. The primary reason
for changing key words is that all documentation for CMakeLists.txt now
shows the key words as lower case. Even the printed “Mastering CMake v5”
uses lower case.  I’ve come across this several times in my class where
students stumble over the fact that the documentation about Cmake does
not match the implementation in ITK.

A script (a wrapper around a vim macro) written that can make these
substituions reliably (Tested on the BRAINS tree, the Slicer3 tree,
CMake and the ITK tree without causing any errors).  More complete
documentation can be found in
ITK/Utilities/Maintenance/HowToCreateTheCMakeCaseConversion.txt

CMake files are taken as a reference materials for many other tools, and
the conventions shown in these files are often copied and pasted in many
other packages.  By making these consistent, a more uniform look and
feel can be acheived across cmake compliant packages.

HOW TO REPLICATE:
This is documentation for the process to convert all
CMakeLists.txt files to lower case format (as seems
to be the default style in all recent documentation).

Step Kitware#1:
Determine all the cmake commands:
TMP_DIR=/tmp
cmake --help-command-list > ${TMP_DIR}/firstpass_script.vi

Step Kitware#2:
Use vim to convert the list into a vim compliant script file that can be
applied to each file:

Open firstpass_script.vi in vim, and issue the following substitution:
vim ${TMP_DIR}/firstpass_script.vi
:%s/^\(.*\)/:%s#\\<\U\1\\> *(#\l\1(#\ge/ge
<<< Add ":%s/  *$//ge" to remove end of line spaces.
<<< Add ":wqa" to end of the vim script >>>
<<< Add ":%s#\<SUBDIRS\> *(#add_subdirectory(#ge" >>>
:w! /tmp/convert_cmake_to_lowercase.vim

This will create a file that is suitable for using as
a vim batch script.

Step Kitware#3:  Make list of files to convert

===============================================================
\#!/bin/bash
VIM_SCRIPT=$(dirname $0)/convert_cmake_to_lowercase.vim

PROCESS_DIR=$1

FILESTOCONVERT=/tmp/FileToConvert
find . -name CMakeLists.txt |fgrep -v svn  > ${FILESTOCONVERT}
find . -name "*.cmake*"     |fgrep -v svn  >>${FILESTOCONVERT}

if [ ! -f "${VIM_SCRIPT}" ]; then
   echo "${VIM_SCRIPT} not found"
   exit -1·
fi

old_IFS=$IFS
IFS=$'\n'
for ff in $(cat ${FILESTOCONVERT}|fgrep -v svn); do
  echo "PROCESSING $ff"
  vim -S ${VIM_SCRIPT} $ff
  if [ -f stop ]; then
    exit -1
  fi
done
IFS=$old_IFS
===============================================================
bradking added a commit that referenced this pull request Jul 31, 2012
Teach CMake to prefer the system default compiler automatically.  Look
for system compilers with generic names before GNU-specific names.
Other vendor-specific names already have lower priority.

 C:   Prefer "cc" before GNU "gcc"
 C++: Prefer "CC" before "c++" or GNU "g++"

This will change the default compiler selection for existing build
scripts that do not specify a compiler when run on machines with
separate system and GNU compilers both installed in the PATH.

We do not make this change in default behavior lightly.  Howerver:

(1) If a given build really needs specific compilers one should specify
    them explicitly e.g. by setting CC and CXX in the environment.

(2) The motivating case is to prefer the system Clang on OS X machines
    over the older GNU compilers typically also installed.  On newer
    OS X versions the name "c++" links to Clang so the old behavior
    picked Clang for C++ and GNU for C by default.

(3) Other than the motivating OS X case the conditions under which the
    behavior changes do not tend to exist in default OS installations.
    They typically occur only on non-GNU systems with manually-installed
    GNU compilers.

(4) The consequences of the new behavior are not dire.  At worst the
    project fails to compile with the system compiler when it previously
    worked with the non-system GNU compiler.  Such failure is easy to
    work around (see #1).

In short this change fixes default behavior on a widely-used platform
at the cost of a modest change in behavior in less-common conditions.
bradking added a commit that referenced this pull request Aug 2, 2012
Teach CMake to prefer the system default compiler automatically when no
compiler is specified.  By default use "cc" for C, "CC" for C++, and
"f95" for Fortran.  Load a new Platform/<os>-<lang>.cmake module to
allow each platform to specify for each language its system compiler
name(s) and/or exclude certain names.

Create Platform/(CYGWIN|Darwin|Linux|Windows)-CXX.cmake modules to
specify "c++" as the system C++ compiler name for these platforms.  On
systems that use case-insensitive filesystems exclude C++ compiler names
that are distinguished from C compiler names only by case.

This will change the default compiler selection for existing build
scripts that do not specify a compiler when run on machines with
separate system and GNU compilers both installed in the PATH.  We do not
make this change in default behavior lightly.  However:

(1) If a given build really needs specific compilers one should specify
    them explicitly e.g. by setting CC, CXX, and FC in the environment.

(2) The motivating case is to prefer the system Clang on newer OS X
    systems over the older GNU compilers typically also installed.  On
    such systems the names "cc" and "c++" link to Clang.  This is the
    first platform known to CMake on which "c++" is not a GNU compiler.
    The old behavior selected "gcc" for C and "c++" C++ and therefore
    chooses GNU for C and Clang for C++ by default.  The new behavior
    selects GNU or Clang consistently for both languages on older or
    newer OS X systems, respectively.

(3) Other than the motivating OS X case the conditions under which the
    behavior changes do not tend to exist in default OS installations.
    They typically occur only on non-GNU systems with manually-installed
    GNU compilers.

(4) The consequences of the new behavior are not dire.  At worst the
    project fails to compile with the system compiler when it previously
    worked with the non-system GNU compiler.  Such failure is easy to
    work around (see #1).

In short this change creates a more sensible default behavior everywhere
and fixes poor default behavior on a widely-used platform at the cost of
a modest change in behavior in less-common conditions.
kwrobot pushed a commit that referenced this pull request Oct 17, 2013
As reported by Coverity Scan, if the configured file contains a #include,

  Untrusted array index read
  The array index could be controlled by an attacker, leading to reads outside
  the bounds of the array.
  In main: Read from array at index computed using an unscrutinized value from
  an untrusted source (CWE-129)

  CID 1081283 (#1 of 1): Untrusted array index read (TAINTED_SCALAR)
  25. tainted_data: Using tainted variable "testToRun" as an index into an array
  "cmakeGeneratedFunctionMapEntries".
mathstuf pushed a commit to mathstuf/CMake that referenced this pull request Apr 15, 2014
kwrobot added a commit that referenced this pull request Aug 31, 2017
Code extracted from:

    https://github.com/pboettch/vim-cmake-syntax.git

at commit 40f5f4f356251802c0a12f63e5f717debbd0cadc (master).

Upstream Shortlog
-----------------

Daniel Hahler (1):
      84967b5c Skip escaped quotes in cmakeString

Patrick Boettcher (11):
      de7c9072 extract properties as well
      5e4f9718 update keywords to latest cmake-revision
      96ee5480 fix #1 - highlight escaped quotes in strings
      d791d3ac README updated, install instruction
      e12d6cb4 do not highlight cmake-commands in cmake-command argument-list
      d2d564aa multi-line comments are now highlighted (again)
      0e62850d update keywords to v3.9.1-460-gce2750817
      65932f07 add test-framework and two tests
      018855b2 add cpo-saving and restoring (taken from vim's upstream-syntax-files)
      8fcb0a7d updated keywords to 3.9.20170830-ge0713
      40f5f4f3 preparations to be for inclusion to vim-repo
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant