Commit Graph

544 Commits

Author SHA1 Message Date
David Cole c95d1baa19 Merge topic 'position-independent-targets'
bd34963 Refactor generation of shared library flags
55d7aa4 Add platform variable for flags specific to shared libraries
31d7a0f Add platform variables for position independent code flags
2012-06-12 16:01:04 -04:00
Stephen Kelly 55d7aa4c44 Add platform variable for flags specific to shared libraries
Store in CMAKE_${lang}_COMPILE_OPTIONS_DLL flags from
CMAKE_SHARED_LIBRARY_${lang}_FLAGS that are truly exclusive to shared
libraries.
2012-06-12 15:38:48 -04:00
Stephen Kelly 31d7a0f2e3 Add platform variables for position independent code flags
Store in new platform variables

  CMAKE_${lang}_COMPILE_OPTIONS_PIC
  CMAKE_${lang}_COMPILE_OPTIONS_PIE

flags for position independent code generation.

In almost all cases, this means duplication of the
CMAKE_SHARED_LIBRARY_${lang}_FLAGS for the _PIC case and using the
assumed pie equivalent for the _PIE case.  Note that the GNU compiler
has supported -fPIE since 3.4 and that there is no -fPIC on GNU for
Windows or Cygwin.

There is a possibility that the _PIE variables are not correct.
However, as there is no backwards compatibility to be concerned about
(as the POSITION_INDEPENDENT_CODE property is not used anywhere yet),
the current state suffices.
2012-06-12 15:37:53 -04:00
Charlie Sharpsteen 8b2fb3310b Mac: Add guards to CMAKE_FIND_FRAMEWORK and CMAKE_FIND_APPBUNDLE defaults
The default for `CMAKE_FIND_FRAMEWORK`, defined in `Darwin.cmake` and
`Darwin-icc.cmake`, is now guarded so that it will not override command line
arguments passed by users.

Similarly for `CMAKE_FIND_APPBUNDLE`
2012-05-31 08:10:17 -04:00
David Cole 8df7aa54f0 Merge topic 'module-no-soname'
fdb3f87 Test NO_SONAME property (#13155)
e1409ac Support building shared libraries or modules without soname (#13155)
2012-05-01 14:09:59 -04:00
Modestas Vainius e1409ac59b Support building shared libraries or modules without soname (#13155)
Add a boolean target property NO_SONAME which may be used to disable
soname for the specified shared library or module even if the platform
supports it.  This property should be useful for private shared
libraries or various plugins which live in private directories and have
not been designed to be found or loaded globally.

Replace references to <CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG> and
hard-coded -install_name flags with a conditional <SONAME_FLAG> which is
expanded to the value of the CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG
definition as long as soname supports is enabled for the target in
question.  Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in
rules in case third party projects still use it.  Such projects would
not yet use NO_SONAME so the adjacent <TARGET_SONAME> will always be
expanded.  Make <TARGET_INSTALLNAME_DIR> NO_SONAME aware as well.  Since
-install_name is soname on OS X, this should not be a problem if this
variable is expanded only if soname is enabled.

The Ninja generator performs rule variable substitution only once
globally per rule to put its own placeholders.  Final substitution is
performed by ninja at build time.  Therefore we cannot conditionally
replace the soname placeholders on a per-target basis.  Rather than
omitting $SONAME from rules.ninja, simply do not write its contents for
targets which have NO_SONAME.  Since 3 variables are affected by
NO_SONAME ($SONAME, $SONAME_FLAG, $INSTALLNAME_DIR), set them only if
soname is enabled.
2012-04-30 11:50:27 -04:00
Brad King dd08062ac2 Intel: On Windows use /RTC1 instead of deprecated /GZ (#13174) 2012-04-30 08:29:47 -04:00
Brad King 4f80896e6c Intel: On Windows use /EHsc instead of deprecated /GX (#13163)
Use of the deprecated option with Intel 2011 produces

 icl: command line remark #10010: option '/GX' is deprecated and will
 be removed in a future release. See '/help deprecated'

so use its replacement option which has been supported for several
older versions anyway.
2012-04-24 09:00:37 -04:00
David Cole 6190415436 OS X: Mark find_program results as advanced
Avoid cluttering the gui with variables nearly nobody needs
to see.
2012-04-06 11:15:39 -04:00
David Cole d9edf46760 OS X: Use correct extra path when searching for applicaton bundles (#13066)
The parent commit added a search path relative to OSX_DEVELOPER_ROOT.
But with Xcode 4.3 the nested Applications folder is in a different
relative location compared to that root. This commit makes the intent
of the previous commit work with older and newer Xcode directory layouts.

Furthermore, it only adds paths that exist to the search path.
2012-04-06 11:14:37 -04:00
Kashif Rasul 98b9a7f6ff OS X: Use OSX_DEVELOPER_ROOT for app search path (#13066)
Since commit 4693cf84 (Xcode: Detect new default locations of Xcode 4.3
bits and pieces) Darwin.cmake detects the developer application
directory instead of hard-coding /Developer.  Replace the hard-coded
path in CMAKE_SYSTEM_APPBUNDLE_PATH using the computed result.
2012-03-26 09:28:56 -04:00
Alex Neundorf 1ab4b3e123 guard eCos.cmake against multiple inclusion (#12987)
Alex
2012-03-20 22:13:47 +01:00
Brad King bfc8d137c5 Merge topic 'fix-12621-xcode43'
0f4dfa6 CPack: Use real path to PackageMaker to find its version file (#12621)
4693cf8 Xcode: Detect new default locations of Xcode 4.3 bits and pieces (#12621)
2012-03-19 14:41:43 -04:00
Brad King 572994bd9f Merge topic 'ninja-generator'
8485208 Ninja: shell escape $(CMAKE_SOURCE_DIR) and $(CMAKE_BINARY_DIR)
df84767 Ninja: add support for OBJECT_OUTPUTS, fix PrecompiledHeader test case
48eb7fc Ninja: Avoid using 'this' in member initializers
bba37dd Ninja: Fix for PDB files with spaces in the path.
ac800f4 Ninja: Constify use of cmCustomCommand
9a0d5a8 Ninja: add /DEF: flag to linker call
d40eebd Ninja: Add a cache option CMAKE_ENABLE_NINJA to enable the ninja generator.
8c63433 Ninja: Add friend struct so it can access the private ConvertToNinjaPath.
dbe3dce Ninja: add .def file support
f1bb08f Ninja: ensure the output dir exists at compile time
7a6b5f4 Ninja: Remove an unnecessary variable
80ff210 Ninja: Use cmSystemTools::ExpandListArgument to split compile/link commands
d2731a3 Ninja: Add a missed license header
eabc9b0 Ninja: CMake: Adapt Ninja generator for per-target include dirs
bada88e Merge branch 'target-include-directories' into ninja-generator
54bd175 Ninja: windows msvc: create for each target a .pdb file
...
2012-03-19 09:29:06 -04:00
David Cole 4693cf8492 Xcode: Detect new default locations of Xcode 4.3 bits and pieces (#12621)
Xcode 4.3 installs into "/Applications" by default, from the Mac App Store.

Also, the paths to the available SDKs changed: they are now within the
Xcode.app bundle.

PackageMaker is installed as a separate program, and may be installed
anywhere. It is not installed with Xcode 4.3 by default anymore.
Download the "Auxiliary Tools for Xcode" to get PackageMaker.
Put PackageMaker inside the Xcode.app bundle, in its nested Applications
folder, or put it alongside Xcode in "/Applications" and CMake will find
it.

Update references to "find" paths: add new possible locations for finding
Xcode.app and PackageMaker.app. Prefer the most recent version's locations
first, but keep the old locations as fallback search paths, too.

Thanks to all the contributors who provided and tested out various patches
for fixing this issue. Especially, but by no means limited to:
Francisco Requena Espí, Jamie Kirkpatrick and drfrogsplat.
2012-03-08 22:43:19 -05:00
Brad King bdbbf763d6 Recognize Embarcadero compiler (#12604)
The Borland compiler was re-branded as CodeGear during 2007-2009 and
since 2009 is the Embarcadero compiler.  They offer predefined macros:

  http://docwiki.embarcadero.com/RADStudio/en/Predefined_Macros

and distinguish themselves by __CODEGEARC__ and __CODEGEARC_VERSION__.

Version 6.30 (C++Builder XE) changed the meaning of some flags:

  http://docwiki.embarcadero.com/RADStudio/en/C%2B%2B_Compiler_Option_Changes_for_XE

Teach Embarcadero compiler information files to generate build rules
with flags matching the compiler version.  Leave the flags unchanged
for old Borland versions.  Always set the BORLAND toolchain indicator
for compatibility with existing projects that test it.  Also set the
EMBARCADERO indicator for newer toolchains.
2012-02-20 10:09:44 -05:00
Peter Kuemmel f999a59afe Ninja: don't define MSVC_IDE when using the ninja generator
Thanks to Oscar Fuentes
2012-02-18 11:24:41 +01:00
Brad King 3f78ced7c2 Rename Modules/Platform/Windows-{Borland => Embarcadero}.cmake
The Borland compiler is now the Embarcadero compiler.  Rename the shared
platform information file to reflect this.  This does not change the
interface, as old versions are still "Borland", but will allow new
versions released by Embarcadero to be supported cleanly.
2012-02-17 17:04:19 -05:00
Brad King 35a5838779 Intel: Fix Windows per-config Fortran flags (#12642)
Fix typo introduced in commit 66a08c10 (more uniform approach to enable
language, 2004-08-26).  The optimization option should be /O2 for
Release configurations and /O1 for MinSizeRel.

Suggested-by: He Yuqi <yuqi.he@gmail.com>
2012-01-02 13:56:33 -05:00
David Cole f7be6d616f Merge topic 'GNU-to-MS'
c213eb9 Windows-GNU: Remove extra quotes in GNUtoMS rule variable
2011-12-16 10:15:44 -05:00
David Cole 65db5b4a99 Merge topic 'osx-dependent-libraries'
5d99343 Do not link private dependent shared libraries on OS X > 10.4
2011-12-16 10:15:07 -05:00
Brad King 5d9934312d Do not link private dependent shared libraries on OS X > 10.4
The default OS X 10.4 linker incorrectly searches for dependencies of
linked shared libraries only under the -isysroot location.  It fails to
find dependencies of linked shared libraries in cases such as the
ExportImport test.  It produces errors like:

 /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library:
 libtestLib3Imp.dylib
 referenced from: /.../ExportImport/Root/lib/libtestLib3lib.1.2.dylib
 (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
 /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols: _testLib3Imp
 referenced from libtestLib3lib expected to be defined in
 libtestLib3Imp.dylib

or with CMAKE_SKIP_RPATH off to enable install_name in the Export side:

 /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning can't open dynamic library:
 /Developer/SDKs/MacOSX10.4u.sdk/.../ExportImport/Export/impl/libtestLib3Imp.dylib
 referenced from: /.../ExportImport/Export/libtestLib3lib.1.2.dylib
 (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
 /usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:_testLib3Imp
 referenced from libtestLib3lib expected to be defined in
 /.../ExportImport/Export/impl/libtestLib3Imp.dylib

Note how "/Developer/SDKs/MacOSX10.4u.sdk" is prepended to the dependent
library path.

Commit 2cff26fa (Support linking to shared libs with dependent libs,
2008-01-31) and commit 82fcaebe (Pass dependent library search path to
linker on some platforms, 2008-02-01) worked around the problem by
defining platform variable CMAKE_LINK_DEPENDENT_LIBRARY_FILES.  It tells
CMake to link to dependent libraries explicitly by their path thus
telling the linker where to find them.

Unfortunately the workaround had the side effect of linking dependent
libraries and defeats most benefits of LINK_INTERFACE_LIBRARIES.
Fortunately OS X 10.5 and above do not need to find transitive
dependencies at all so we can avoid the workaround on Modern OS X.
2011-12-15 08:14:30 -05:00
Brad King 5720e1f634 HP: Drive shared library linking with compiler front end
Previously we linked C, Fortran, and ASM shared libraries compiled with
the HP compiler using a direct invocation of the linker (ld).  This
behavior was left historically from support for an ancient HP C compiler
that did not know how to create shared libraries.  Fortran shared
libraries need to be linked with the compiler to get the language
runtime library dependencies as is already done for C++.

Update the HP-UX-HP* platform information to use the compiler front end
when linking shared libraries.  This works on modern HP tools and
produces correct behavior.  If there is a need to support older tools
again we can add a special case for them.
2011-12-14 09:32:27 -05:00
Brad King c213eb9cbf Windows-GNU: Remove extra quotes in GNUtoMS rule variable
CMake replaces the <TARGET...> tokens with properly quoted values so we
do not need an extra set of quotes around them.
2011-12-08 13:28:37 -05:00
David Cole 386cf3c593 Merge topic 'GNU-to-MS'
ae62a1c Test CMAKE_GNUtoMS option in ExportImport on MinGW and MSys
afb00fe Add CMAKE_GNUtoMS option to convert GNU .dll.a to MS .lib
61e8629 Factor makefile generator link rule lookup into helper function
a603250 Load platform files that need to know the ABI when possible
ecd8414 Fortran: Detect pointer size in gfortran on MinGW
2011-12-06 15:07:39 -05:00
Brad King afb00fef19 Add CMAKE_GNUtoMS option to convert GNU .dll.a to MS .lib
Teach the Windows-GNU.cmake platform file to look for Visual Studio
tools matching the target ABI.  Add an extra step to the link command
for shared libraries and executables that export symbols and on which a
new GNUtoMS property is set (initialized by the CMAKE_GNUtoMS option).
Tell the GNU linker to output a module definition (.def) file listing
exported symbols in addition to the GNU-format import library (.dll.a).
Pass the .def file to the MS "lib" tool to construct a MS-format DLL
import library (.lib).

Teach the install(TARGETS) command to install the MS import library next
to the GNU one.  Teach the install(EXPORT) and export() command to set
the IMPORTED_IMPLIB property pointing at the import library to use the
import library matching the tools in the importing project.
2011-12-05 18:13:49 -05:00
Brad King ecd8414757 Fortran: Detect pointer size in gfortran on MinGW
Use __SIZEOF_POINTER__ which the GNU Fortran compiler defines at least
on 64-bit MinGW.  Assume default size 4 on MinGW if gfortran does not
define the size.
2011-12-05 16:32:29 -05:00
Brad King ec636e299f TinyCC: Add compiler info for shared libs on Linux (#12605)
Use the "-shared" option to link shared libraries.  The compiler does
not support "-Wl," or "-rpath" but does know how to pass "-soname"
through to the linker.
2011-12-02 10:23:48 -05:00
Todd Gamblin 5993891e8d Fixed link bugs in BlueGeneP build.
- Build wasn't properly using -soname linker args, so installed libraries
  could depend on relative paths from the build directory.
- Consolidated GNU linker args to one place in the BlueGeneP-base platform
  file, since ld is used by both XL and GNU toolchains on BlueGene.
2011-08-28 22:08:11 -07:00
David Cole dfb307fef5 Merge topic 'fix-old-VisualAge-Fortran'
ad542d8 XL: Fix old VisualAge branding of Fortran compiler
2011-08-16 17:01:47 -04:00
Brad King ad542d821d XL: Fix old VisualAge branding of Fortran compiler
Commit 6d434ee6 (Split XL compiler information files, 2009-09-30)
added Platform/AIX-(XL|VisualAge)-(C|CXX|Fortran).cmake modules
to support the old and new compiler branding for all languages.
Add the "AIX-VisualAge-Fortran" combination that was left out
accidentally.
2011-08-02 17:26:29 -04:00
David Cole bd54141d5d Merge topic 'fix-11866-add-watcom-sys-libs'
ff59716 Watcom: Use correct args for execute_process call (#11866)
80769cd Add Watcom support to InstallRequiredSystemLibraries (#11866)
2011-08-02 15:11:35 -04:00
David Cole ff59716351 Watcom: Use correct args for execute_process call (#11866)
I botched an exec_program to execute_process translation on Friday.
RESULT_VARIABLE is the correct argument to execute_process.
2011-08-01 15:29:13 -04:00
David Cole a0974ae2e6 Watcom: Add -c flag to wlib calls (#12245)
Allows wlib to generate proper exports if two routines have
the same spelling, but different case (like Scale and scale).

Thanks to J Decker for the patch.
2011-07-29 13:52:23 -04:00
David Cole 80769cdd1e Add Watcom support to InstallRequiredSystemLibraries (#11866)
Also adds code to determine the version of the Watcom compiler
in use.

Thanks to J Decker for the patch.
2011-07-29 13:28:54 -04:00
Matej Hribernik aed92ccea6 Add VisualStudio 9 and 10 generators for Itanium platform 2011-06-20 08:31:13 -04:00
Modestas Vainius 1ed19bcb25 multiarch: Set CMAKE_LIBRARY_ARCHITECTURE_REGEX for Linux|Hurd|kFreeBSD
* Fix linux CMAKE_LIBRARY_ARCHITECTURE_REGEX to support armel-linux-gnueabi.
* Add CMAKE_LIBRARY_ARCHITECTURE_REGEX on kFreeBSD.
* Add CMAKE_LIBRARY_ARCHITECTURE_REGEX on GNU (Hurd).

Also regex is improved to support quadlets.  Even if I have not seen this
in the wild yet, reportedly they are possible.
2011-06-13 11:12:23 -04:00
Brad King b41ad3b399 Teach find_(library|package) about Linux multiarch (#12037)
Implement support for multiarch as specified here:

  http://wiki.debian.org/Multiarch
  https://wiki.ubuntu.com/MultiarchSpec

Detect the <arch> part of <prefix>/lib/<arch> from the implicit library
search path from each compiler to set CMAKE_<lang>_LIBRARY_ARCHITECTURE.
Define CMAKE_LIBRARY_ARCHITECTURE using one of these values (they should
all be the same).  Teach the find_library and find_package commands to
search <prefix>/lib/<arch> whenever they would search <prefix>/lib.
2011-06-08 10:04:44 -04:00
Brad King 1605784f47 Merge topic 'absoft-fortran-compiler'
8bd3e51 Absoft: Enable FortranCInterface check in Fortran test
d7b376b Absoft: Detect implicit link libraries on Linux and Mac
ac5b999 Add Absoft Fortran compiler id and basic flags
2011-05-24 14:34:40 -04:00
Brad King d7b376b3a7 Absoft: Detect implicit link libraries on Linux and Mac
Use the "-X -v" flag to the Absoft front-end to pass "-v" to the gcc it
invokes under the hood.  Teach CMakeParseImplicitLinkInfo to exclude
linker version lines from consideration as link lines.  Fix parsing of
Sun's linker search path option "-Y..." to avoid conflict with the Mac
linker option "-Y<num>".
2011-05-20 08:57:51 -04:00
Brad King 1c3233a850 Merge topic 'include-flags-response-file'
86cb17b Pass include directories with response files to GNU on Windows
9a0b9bc Optionally pass include directories with response files
6e8a67f Generate target-wide flags before individual build rules
d099546 Factor old-style -D flags out from -I flag generation
2011-03-22 14:45:44 -04:00
Brad King 86cb17b18d Pass include directories with response files to GNU on Windows
The GNU 4.x toolchain on MinGW (and therefore MSYS) allows compiler
options to be passed via response files.  Use this to pass include
directory -I options.  This allows the include file search path to be
very long despite shell and mingw32-make command line length limits.
2011-03-17 17:56:14 -04:00
Brad King d0f71e2545 Add ASM platform information for HP compiler on HP
Among other flags this sets RPATH flags correctly so that CMake knows
how to treat CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH for the ASM language.
2011-03-02 17:49:17 -05:00
Brad King bd580be526 Merge branch 'hp-compiler-info' into ReworkedAsmSupport 2011-03-02 17:40:55 -05:00
Brad King 5f0a25955f Factor HP compiler flags into per-platform/per-compiler files
Move HP flags out of Platform/HP-UX.cmake into platform-specific
compiler information files "Platform/HP-UX-HP-<lang>.cmake".  Factor
common values into "Platform/HP-UX-HP.cmake" and load it from the
per-language files.
2011-03-02 17:24:36 -05:00
Brad King a0bab7ae69 Add ASM platform information for XL compiler on AIX
Among other flags this sets RPATH flags correctly so that CMake knows
how to treat CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH for the ASM language.
2011-03-02 13:48:04 -05:00
Brad King c03b610c0a Merge branch 'aix-xl-platform-info' into ReworkedAsmSupport 2011-03-02 13:47:11 -05:00
Brad King d30dcf18b9 Move RPATH flags to AIX per-compiler information files
Move RPATH flags out of Platform/AIX.cmake into platform-specific
compiler information files Platform/AIX-XL and Platform/AIX-GNU.
The flags need to be set for each compiler of each language.
2011-03-02 11:21:54 -05:00
Brad King 89ea7a3d3c Factor AIX and XL compiler flags into common module
Factor duplicate flag information from Platform/AIX-XL-*.cmake into
Platform/AIX-XL.cmake and load it from the original files.
2011-03-02 11:20:50 -05:00
Alex Neundorf 17c658f819 Add support for the Intel compiler used for ASM under Windows
Alex
2011-03-02 16:46:25 +01:00