Commit Graph

526 Commits

Author SHA1 Message Date
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
Brad King 307bdadadc Merge topic 'mingw-module-definition'
6c4b249 Fix Fortran test .def file symbol mangling
7616216 Pass .def files directly to MinGW tools (#9997)
2011-02-24 08:30:26 -05:00
Brad King 761621645c Pass .def files directly to MinGW tools (#9997)
Commit 6a61a8a5 (Honor module .def files with MinGW tools, 2011-02-21)
set CMAKE_LINK_DEF_FILE_FLAG to "-Wl," to enable passing .def files to
the linker on MinGW.  However, older GNU tools in the MSYS shell do not
know how to translate "-Wl,/c/..." to "c:/..." and complain that the
file does not exist.  Instead set the flag to just "" which tells CMake
it can pass the file through the front-end with no special flag.
2011-02-23 11:04:17 -05:00
Brad King 521d244531 Merge topic 'mingw-module-definition'
6a61a8a Honor module .def files with MinGW tools (#9997)
2011-02-22 14:33:04 -05:00
Brad King 6a61a8a538 Honor module .def files with MinGW tools (#9997)
Since commit 024d05ad (Fix use of module .def files for MS tools,
2009-09-29) module .def files work for any platform that sets
CMAKE_LINK_DEF_FILE_FLAG correctly.  Set it in the Windows-GNU platform
information file to enable support with MinGW tools.  Also enable the
test added by commit 0db2c850 (Test use of module .def files for MS
tools, 2009-09-29) for MinGW and MSYS generators.
2011-02-21 14:34:54 -05:00
David Cole d421a433a8 Strip trailing space from xcode-select output (#10723)
Otherwise, subsequent use of the output does not work
as intended.
2011-02-01 14:16:30 -05:00
Brad King e60c8ec6c7 Factor SCO compiler info out of platform file (#11700)
Move these flags out of the SCO_SV platform file so that other compilers
may be used on that platform without interference.
2011-01-17 09:57:17 -05:00
Brad King 3556ab9f72 Merge topic 'add_support_for_windres'
971692c Build enable_language command during bootstrap
960ace1 Add testing for windows resources for mingw/msys/cygwin and remove for watcom.
060d6e8 Add support for windres to cygwin.
b2f308c Add support for windows resources with mingw/msys.
2011-01-04 15:44:07 -05:00
Bill Hoffman 90b0f2c624 Enable resource building with the intel compiler on windows. 2011-01-03 14:02:22 -05:00
Brad King 9ffe22b2eb Merge topic 'mac-headerpad_max_install_names-passthru'
e498527 Pass Mac linker flag through all compilers with -Wl,
2010-12-28 15:26:00 -05:00
Bill Hoffman 060d6e885e Add support for windres to cygwin. 2010-12-23 17:04:50 -05:00
Bill Hoffman b2f308c8f9 Add support for windows resources with mingw/msys. 2010-12-23 17:04:49 -05:00
Brad King e498527f1d Pass Mac linker flag through all compilers with -Wl,
The Mac linker defines flag -headerpad_max_install_names but not all
front-ends recognize the flag and pass it through (many did in the past,
such as the Apple port of GCC).  Use the -Wl, option prefix to tell
front-ends to pass it through without trying to interpret it.
2010-12-22 16:28:54 -05:00
Brad King 9f46051490 Merge topic 'cygwin'
85c0a69 Cygwin: Do not define 'WIN32' (#10122)
62c6d2d Merge branch 'cmake_--system-information_min-version' into cygwin
72db20f Merge branch 'tests-if-CYGWIN' into cygwin
5adef16 Merge branch 'cygwin-module-prefix' into cygwin
cbc3258 Merge branch 'try-compile-min-version' into cygwin
2010-12-21 14:06:32 -05:00
Brad King 98d9611ffa Merge topic 'gnu-compiler-windows-info'
e8d380f Remove unused old-style g++ info file
2010-12-21 13:58:46 -05:00
Brad King 6f2482aa97 Merge topic 'intel-compiler-windows-info'
cd43636 Modernize Intel compiler info on Windows
58c73c4 Detect Fortran target architecture on Windows
2010-12-21 13:58:39 -05:00
Brad King 92631c14d9 Merge topic 'intel-config-definitions'
3fb088e Make Intel defines consistent with MSVC on Windows (#9904)
2010-12-21 13:58:29 -05:00
Brad King 85c0a69a92 Cygwin: Do not define 'WIN32' (#10122)
One of Cygwin's goals is to build projects using the POSIX API with no
Windows awareness.  Many CMake-built projects have been written to test
for UNIX and WIN32 but not CYGWIN.  The preferred behavior under Cygwin
in such projects is to take the UNIX path but not the WIN32 path.

Unfortunately this change is BACKWARDS INCOMPATIBLE for Cygwin-aware
CMake projects!  Some projects that previously built under Cygwin and
are Cygwin-aware when they test for WIN32 may now behave differently.
Eventually these projects will need to be updated, but to help users
build them in the meantime we print a warning about the change in
behavior.  Furthermore, one may set CMAKE_LEGACY_CYGWIN_WIN32 to request
old behavior during the transition.

Normally we avoid backwards incompatible changes, but we make an
exception in this case for a few reasons:

(1) This behavior is preferred by Cygwin's design goals.

(2) A warning provides a clear path forward for everyone who may see
incompatible behavior, and CMAKE_LEGACY_CYGWIN_WIN32 provides a
compatibility option.  The warning and compatibility option both
disappear when the minimum required version of CMake in a project is
sufficiently new, so this issue will simply go away over time as
projects are updated to account for the change.

(3) The fixes required to update projects are fairly insignificant.
Furthermore, the Cygwin distribution has no releases itself so project
versions that predate said fixes tend to be difficult to build anyway.

(4) This change enables many CMake-built projects that did not
previously build under Cygwin to work out-of-the-box.  From bug #10122:

  "I have built over 120 different source packages with (my patched)
   CMake, including most of KDE4, and have found that NOT defining
   WIN32 on Cygwin is much more accurate." -- Yaakov Selkowitz

A fully compatible change would require patches on top of these project
releases for Cygwin even though they otherwise need not be aware of it.

(5) Yaakov has been maintaining a fork of CMake with this change for the
Cygwin Ports distribution.  It works well in practice.  By accepting the
change in upstream CMake we avoid confusion between the versions.

CMake itself builds without WIN32 defined on Cygwin.  Simply disable
CMAKE_LEGACY_CYGWIN_WIN32 explicitly in our own CMakeLists.txt file.
2010-12-17 14:19:58 -05:00
Brad King 3a6c480908 Merge topic 'cygwin-module-prefix'
1dcc977 Cygwin: Use 'cyg' prefix for module DLLs (#10122)
2010-12-16 14:00:06 -05:00