summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Port static calls from cmLocalGenerator to cmOutputConverter.Stephen Kelly2015-06-061-3/+3
|
* Don't use a cmLocalGenerator instance to call static methods.Stephen Kelly2015-05-141-4/+4
|
* Port to static cmPolicies API.Stephen Kelly2015-05-041-4/+2
|
* cmState: Move CacheEntryType enum from cmCacheManager.Stephen Kelly2015-04-131-2/+1
|
* Include cmAlgorithms where it is used.Stephen Kelly2015-03-101-0/+1
|
* Convert some raw loops to cmWrap.Stephen Kelly2015-02-201-5/+3
|
* Use cmJoin where possible.Stephen Kelly2015-02-201-12/+3
|
* cmCoreTryCompile: Remove variable assignment.Stephen Kelly2015-02-171-2/+1
| | | | | The variable is not a reference, and we return in the same scope after assigning, so it has no effect.
* try_compile: Use shorter test executable name with consistent lengthBrad King2015-02-101-2/+2
| | | | | | | | | | | | | Since commit v2.8.8~176^2 (try_compile: Use random executable file name, 2012-02-13) the length of the test executable name in generated try_compile projects has been longer and unpredictable. With Visual Studio on windows, the tools try to create paths like: CMakeFiles/CMakeTmp/$tgt.dir/Debug/$tgt.tlog/$tgt.lastbuildstate With the target name repeated up to 3 times, we must make it short and of consistent length to avoid overrunning the 260 character limit imposed by VS tools.
* try_compile: Quote the content of CMAKE_MODULE_PATH to allow for spacesNils Gladitz2015-02-091-1/+1
|
* Merge topic 'try-run-link-libraries'Brad King2015-01-261-1/+1
|\ | | | | | | | | | | | | d0adcccb try_run: Add tests for LINK_LIBRARIES with mock libraries. 223c5cb7 try_run: Add test for bad link libraries. e2b1f058 try_run: Add support for LINK_LIBRARIES option.
| * try_run: Add support for LINK_LIBRARIES option.Matt McCormick2015-01-261-1/+1
| | | | | | | | | | | | | | | | Most functionality is already implemented in Source/cmCoreTryCompile.{h,cxx}. Document and improve argument parsing. This functionality is already being used by a number of modules, like CheckCSourceCompiles.cmake, but it is not documented.
* | Replace foo.size() pattern with !foo.empty().Stephen Kelly2015-01-181-4/+4
| |
* | Replace 'foo.size() > 0' pattern with !foo.empty().Stephen Kelly2015-01-181-1/+1
| |
* | Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-7/+7
|/ | | | All compilers hosting CMake support the std class.
* try_compile: Pass linker flags into test project (#14066)Brad King2014-12-031-0/+34
| | | | | | | | | | | | Copy CMAKE_EXE_LINKER_FLAGS into the test project generated by try_compile, just like we already copy CMAKE_<LANG>_FLAGS. Add CMake Policy CMP0056 to activate this behavior in a compatible way, but do not warn by default when the policy is not set since it will affect all try_compile calls. Extend the RunCMake.try_compile test with a case covering this behavior for each policy setting.
* CMakeDetermineCompilerABI: Use normal linker flags in ABI projectBrad King2014-12-031-0/+2
| | | | | | | | | When compiling the ABI detection test project, do not override CMAKE_EXE_LINKER_FLAGS completely. The normally selected value of this variable may influence how the link is done and may be needed to be representative of how the calling project will be built. Instead pass a variable that try_compile will reference as additional flags. Leave this behavior of try_compile undocumented for now.
* strings: Remove redundant calls to std::string::c_str()Nils Gladitz2014-10-151-8/+8
| | | | | Replacements were detected and performed by the clang tool remove-cstr-calls on a linux build.
* Teach try_compile COPY_FILE to look for IOS app bundles.Bill Hoffman2014-09-231-0/+4
| | | | | The COPY_FILE option on try_compile never looked for IOS application bundles. This caused it to fail if the CMAKE_MACOSX_BUNDLE was set.
* cmGlobalGenerator: Take Build output argument by referenceBrad King2014-07-311-1/+1
| | | | | | No call sites pass NULL to the output argument, so take it by reference to avoid the if(output) conditions. Propagate the change through the TryCompile APIs that call it.
* Remove c_str calls when using stream APIs.Stephen Kelly2014-03-111-3/+3
| | | | | Use an ad-hoc clang tool for matching the calls which should be ported.
* Remove some c_str() calls.Stephen Kelly2014-03-111-7/+7
| | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* stringapi: Pass configuration names as stringsBen Boeckel2014-03-081-1/+1
|
* strings: Remove cmStdString referencesBen Boeckel2014-03-081-1/+1
| | | | | | | | | | | Casts from std::string -> cmStdString were high on the list of things taking up time. Avoid such implicit casts across function calls by just using std::string everywhere. The comment that the symbol name is too long is no longer relevant since modern debuggers alias the templates anyways and the size is a non-issue since the underlying methods are generated since it's inherited.
* stringapi: Use strings in target nameBen Boeckel2014-03-081-5/+6
|
* stringapi: Use strings for the languagesBen Boeckel2014-03-081-1/+2
|
* Windows: Make file delete/rename retry configurableBrad King2014-02-121-4/+9
| | | | | | | | | | | | | | | | | | Several CMake operations need to replace files in rapid succession. This commonly fails on Windows due to filesystem lock behavior so we have retry loops. No matter how many times we retry or how long we delay there will inevitably be someone with an environment that needs more. Make the retry count and delay configurable in the Windows Registry keys: {HKCU,HKLM}/Software/Kitware/CMake/Config in DWORD values FilesystemRetryCount = Number of tries FilesystemRetryDelay = Delay in milliseconds between tries Leave the feature undocumented for now to see how it goes.
* cmMakefile: make some methods take const std::string& instead of const char*Rolf Eike Beer2014-01-161-1/+1
| | | | | | | | Most callers already have a std::string, on which they called c_str() to pass it into these methods, which internally converted it back to std::string. Pass a std::string directly to these methods now, avoiding all these conversions. Those methods that only pass in a const char* will get the conversion to std::string now only once.
* Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.Clinton Stimpson2014-01-071-1/+1
| | | | | Also use SystemTools::Fopen() instead of fopen(). This is to eventually support utf-8 filenames.
* Add CMAKE_SYSROOT variable to set --sysroot when cross compiling.Stephen Kelly2013-11-191-0/+7
| | | | | | | | | | As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is introduced, which is never a list. The contents of this variable is passed to supporting compilers as --sysroot. It is also accounted for when processing implicit link directories reported by the compiler, and when generating RPATH information.
* Allow toolchain files to specify an external toolchain.Stephen Kelly2013-11-191-0/+14
| | | | | | | | | Clang can compile code, but uses the gcc tools for other tasks such as linking. The -gcc-toolchain option can be used for that, but generalize so that other compilers can be treated the same. If such a location is specified, use it as a hint for finding the binutils executables.
* Add compiler target compile options.Stephen Kelly2013-11-191-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | For clang, this allows passing -target <triple> to the compiler, and for qcc, -V<arch> using toolchain files containing something like set(triple arm-linux-gnueabihf) set(CMAKE_C_COMPILER "/usr/bin/clang") set(CMAKE_C_COMPILER_TARGET ${triple}) set(CMAKE_CXX_COMPILER "/usr/bin/clang++") set(CMAKE_CXX_COMPILER_TARGET ${triple}) or set(arch gcc_ntoarmv7le) set(CMAKE_C_COMPILER /opt/qnx650/host/linux/x86/usr/bin/qcc) set(CMAKE_C_COMPILER_TARGET ${arch}) set(CMAKE_CXX_COMPILER /opt/qnx650/host/linux/x86/usr/bin/QCC) set(CMAKE_CXX_COMPILER_TARGET ${arch}) Both clang and qcc are inherently cross compiler( driver)s. When cross-compiling with clang, use the CMAKE_${lang}_COMPILER_TARGET as the _CMAKE_TOOLCHAIN_PREFIX to find the appropriate binutils. When cross-compiling with QNX qcc, use the CMAKE_${lang}_COMPILER_TARGET to set the appropriate _CMAKE_TOOLCHAIN_PREFIX.
* cmTarget: Make GetProperty() const.Stephen Kelly2013-10-311-1/+1
| | | | | | This has follow-on effects for other methods and classes. Further work on making the use of const cmTarget pointers common can be done, particularly with a view to generate-time methods.
* cmCoreTryCompile: Fix typo in comments.Stephen Kelly2013-10-201-2/+2
| | | | Add 'S' to match actual variable names.
* Merge topic 'INTERFACE_LIBRARY-target-type'Brad King2013-10-081-0/+1
|\ | | | | | | | | | | | | ce0c303 install: Teach EXPORT option to handle INTERFACE_LIBRARY targets 435c912 export: Add support for INTERFACE_LIBRARY targets fe73226 Add the INTERFACE_LIBRARY target type.
| * export: Add support for INTERFACE_LIBRARY targetsStephen Kelly2013-10-081-0/+1
| |
* | Generate modern-style cmake code.Stephen Kelly2013-08-221-16/+16
|/ | | | | | | | | | | The commits 9db31162 (Remove CMake-language block-end command arguments, 2012-08-13) and 77543bde (Convert CMake-language commands to lower case, 2012-08-13) changed most cmake code to use lowercase commands and no parameters in termination commands. However, those changes excluded cmake code generated in c++ by cmake. Make a similar style change to code generated by cmake.
* Merge topic 'try_compile-COPY_FILE_ERROR'Brad King2013-07-151-3/+43
|\ | | | | | | | | c28715b try_compile: Add COPY_FILE_ERROR option to capture failure
| * try_compile: Add COPY_FILE_ERROR option to capture failureBrad King2013-07-151-3/+43
| | | | | | | | | | | | | | | | | | | | | | When the COPY_FILE operation fails optionally capture the error message with a COPY_FILE_ERROR option instead of reporting the error immediately. This gives callers a chance to do something else or report the error. Teach the RunCMake.try_compile test to cover bad argument combinations involving COPY_FILE_ERROR. Teach the TryCompile test to cover the case of a COPY_FILE error message captured by COPY_FILE_ERROR.
* | try_compile: Escape CMAKE_<lang>_FLAGS in test projects (#14268)Brad King2013-07-151-8/+8
|/ | | | | | | | | If CMAKE_<lang>_FLAGS contains quotes or other CMake language characters they must be escaped when written into the generated CMakeLists.txt file so that the test project parses them properly. Teach the TryCompile test to cover this case by adding a flag with quotes into CMAKE_C_FLAGS during a C language try_compile.
* cmMakefile: Refactor AddCMakeDependFile and AddCMakeOutputFile.Robert Maynard2013-06-241-1/+1
| | | | | | AddCMakeDependFile and AddCMakeOutputFile both store as std::string and all calling sites use std::string. So instead of creating more temporary objects, lets just use std::strings.
* try_compile: Add signature to allow multiple SOURCESBrad King2013-06-061-57/+93
| | | | | | | | | | | | | | | | | Extend the signature try_compile(RESULT_VAR <bindir> <srcfile> ...) to allow multiple sources as try_compile(RESULT_VAR <bindir> SOURCES <srcfile>... ...) Process the sources to generate a CMakeLists.txt that enables all needed languages. Teach the TryCompile test to try cases with two sources of the same language and of mixed languages. Teach RunCMake.try_compile to cover error cases for the signature.
* try_compile: Refactor argument processingBrad King2013-05-311-133/+103
| | | | | | | | | | Process all arguments in a single loop using a simple state machine. While at it, fix some error message typos. Also allow LINK_LIBRARIES with no actual libraries to disable use of the -DLINK_LIBRARIES=... from the CMAKE_FLAGS. This was already possible in the old logic if LINK_LIBRARIES was immediately followed by another keyword argument instead of the end of the argument list, so allow it in general. Update the RunCMake.try_compile test cases accordingly.
* try_compile: Trim whitespace from LINK_LIBRARIES entriesStephen Kelly2013-05-301-1/+1
| | | | | | | | | | | | | | Commit e65ef08b (try_compile: Fix quoting of libraries in generated CMakeLists.txt, 2013-05-24) added quoting to entries specified in the LINK_LIBRARIES. However, if the input entries contain whitespace padding, that quoted whitespace causes an error in the generated CMakeLists.txt at target_link_libraries. Strictly, it is an error to have space separated entries in the CMAKE_REQUIRED_LIBRARIES, as it was never properly handled by CMakeExpandImportedTargets even prior to commit 236133e7 (Handle targets in the LINK_LIBRARIES of try_compile., 2013-02-09). However, it is causing a regression in KDE code which tests the next branch.
* try_compile: Fix quoting of libraries in generated CMakeLists.txtBrad King2013-05-241-1/+1
| | | | | | | | | | Since commit 236133e7 (Handle targets in the LINK_LIBRARIES of try_compile, 2013-02-09) libraries passed to the new LINK_LIBRARIES option of try_compile are not quoted inside the generated CMakeLists.txt file. Quote the library names so they re-parse correctly when loaded by CMake to configure and generate the test project. Reported-by: Bogdan Cristea <cristeab@gmail.com>
* try_compile: add missing fclose() to recently added error caseRolf Eike Beer2013-04-161-0/+1
| | | | | | | | In commit 236133e7 (Handle targets in the LINK_LIBRARIES of try_compile, 2013-02-09) an error return case was added without closing the file in progress. Add the missing fclose() call. Spotted by sevenhill.
* Handle targets in the LINK_LIBRARIES of try_compile.Stephen Kelly2013-02-221-9/+99
| | | | | | | | | | Imported targets are re-exported so that they can be used by the try_compile generated code with target_link_libraries. This makes the use of the cmake_expand_imported_targets macro obsolete. The macro is not able to expand the generator expressions which may appear in the IMPORTED_LINK_INTERFACE_LIBRARIES content. Instead it just sees them as 'not a target'.
* Refactor generation of shared library flagsStephen Kelly2012-06-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | CMAKE_SHARED_LIBRARY_<lang>_FLAGS has flags on various platforms for a variety of purposes that are correlated with shared libraries but not exclusive to them. Refactor generation of these flags to use new purpose-specific platform variables CMAKE_<lang>_COMPILE_OPTIONS_DLL CMAKE_<lang>_COMPILE_OPTIONS_PIC CMAKE_<lang>_COMPILE_OPTIONS_PIE Activate the DLL flags specifically for shared libraries. Add a new POSITION_INDEPENDENT_CODE target property to activate PIC/PIE flags, and default to true for shared libraries to preserve default behavior. Initialize the new property from CMAKE_POSITION_INDEPENDENT_CODE to allow easy global configuration in projects. Although the default behavior is unchanged by this refactoring, the new approach ignores CMAKE_SHARED_LIBRARY_<lang>_FLAGS completely. We must leave it set in case projects reference the value. Furthermore, if a project modifies CMAKE_SHARED_LIBRARY_<lang>_FLAGS it expects the new value to be used. Add policy CMP0018 to handle compatibility with projects that modify this platform variable. Add a PositionIndependentCode test on platforms where we can get meaningful results.
* try_compile: Cleanup temporary directories (#13160)Brad King2012-04-261-0/+1
| | | | | | | Since commit 4fbdce2b (try_compile: Use random executable file name, 2012-02-13) a different <target>.dir is used for each try-compile. Cleanup the directories as well as their content to avoid accumulating leftover temporary directories.
* Run vim spellcheck on some filesYury G. Kudryashov2012-02-291-2/+2
|