summaryrefslogtreecommitdiffstats
path: root/Tests/TryCompile/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* try_compile: Restore expansion of ;-list in COMPILE_DEFINITIONSBrad King2019-02-151-0/+29
| | | | | | | | | | | | | | | | | | | | | The quoting added by commit 8c5221fb1f (try_compile: Preserve special characters in COMPILE_DEFINITIONS, 2019-01-21, v3.14.0-rc1~108^2~3) broke the case that the `COMPILE_DEFINITIONS` value contains a `;`. Without the quoting the `;` would be generated literally in an unquoted argument in the test `CMakeLists.txt` file and would then be expanded. With quoting the `;` is preserved, which is not the old behavior. Fix this by expanding the `;`-list ahead of time. Add test cases for behavior with both `#` and `;`. This was noticed with the PGI compiler where we set `CMAKE_CXX*_STANDARD_COMPILE_OPTION` to values like `--c++17;-A`. The symptom had also been observed while preparing commit ef8f237686 (ParseImplicitIncludeInfo: add SunPro Fortran and PGI compiler, Cray fix, 2019-01-29, v3.14.0-rc1~26^2~2) but was not recognized at the time as a regression. Revert the workaround added by that commit. Fixes: #18919
* Various typo fixesLuz Paz2018-01-031-2/+2
| | | | Some are user-facing. Others are source comments.
* Use string(APPEND) in TestsDaniel Pfeifer2016-07-271-2/+2
| | | | | | | Automate with: find Tests -type f -print0 | xargs -0 perl -i -0pe \ 's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
* Drop Visual Studio 6 generatorBrad King2016-03-091-3/+1
| | | | | | This generator has been deprecated since CMake 3.3. Remove it. Update documentation, modules, and tests to drop content specific to this generator.
* Avoid if() quoted auto-dereferenceBen Boeckel2014-10-201-2/+2
| | | | | | | When testing CMAKE_<LANG>_COMPILER_ID values, do not explicitly dereference or quote the variable. We want if() to auto-dereference the variable and not its value. Also replace MATCHES with STREQUAL where equivalent.
* Merge topic 'try_compile-COPY_FILE_ERROR'Brad King2013-07-151-0/+17
|\ | | | | | | | | c28715b try_compile: Add COPY_FILE_ERROR option to capture failure
| * try_compile: Add COPY_FILE_ERROR option to capture failureBrad King2013-07-151-0/+17
| | | | | | | | | | | | | | | | | | | | | | 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-0/+18
|/ | | | | | | | | 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.
* try_compile: Add signature to allow multiple SOURCESBrad King2013-06-061-0/+18
| | | | | | | | | | | | | | | | | 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.
* Remove CMake-language block-end command argumentsKitware Robot2012-08-131-35/+35
| | | | | | | | | | | | | | | | | Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. Run the following shell code: for c in else endif endforeach endfunction endmacro endwhile; do echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | egrep -z -v 'Tests/CMakeTests/While-Endwhile-' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Convert CMake-language commands to lower caseKitware Robot2012-08-131-128/+128
| | | | | | | | | | | | | | | | | Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Remove trailing whitespace from most CMake and C/C++ codeKitware Robot2012-08-131-11/+11
| | | | | | | | | | | | | | | | | Our Git commit hooks disallow modification or addition of lines with trailing whitespace. Wipe out all remnants of trailing whitespace everywhere except third-party code. Run the following shell code: git ls-files -z -- \ bootstrap doxygen.config '*.readme' \ '*.c' '*.cmake' '*.cpp' '*.cxx' \ '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \ '*.mm' '*.pike' '*.py' '*.txt' '*.vim' | egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' | egrep -z -v '^(Modules/CPack\..*\.in)' | xargs -0 sed -i 's/ \+$//'
* Tests: Added test for check_prototype_definition.Andreas Schneider2011-03-181-0/+13
|
* CheckCCompilerFlag: Strict signature of 'main' (#11615)Brad King2010-12-161-0/+6
| | | | | | Use "int main(void)" instead of just "int main()" so that compiling with "gcc -Werror=strict-prototypes" works. Test this check using the flags "-Werror -Wstrict-prototypes" to work with old GCC versions.
* Avoid PathScale cmd-line bug in TryCompile testBrad King2010-01-251-2/+8
| | | | | | | | | | | | | | | | | | | | The PathScale compiler silently accepts unknown options that start in more than one '-': $ touch foo.c $ pathcc -c foo.c --junk $ echo $? 0 $ pathcc -c foo.c ---junk $ echo $? 0 $ pathcc -c foo.c -junk pathcc ERROR parsing -junk: unknown flag $ echo $? 2 We teach the TryCompile to pass a bogus flag with only one '-' instead of three '-'s for this compiler.
* Add more coverage and use the ARGS option of try_runBill Hoffman2009-10-291-0/+11
|
* Fix CHECK_(C|CXX)_COMPILER_FLAG macro testBrad King2009-09-181-2/+2
| | | | | | The flag "-_this_is_not_a_flag_" was not rejected by GCC 4.0 on older Mac OS X. We now use "---_this_is_not_a_flag_" instead, which will hopefully be rejected by all compilers.
* Test CHECK_(C|CXX)_COMPILER_FLAG macrosBrad King2009-09-171-1/+9
| | | | | This teaches the TryCompile test to check that the compiler flag check macros correctly reject a bad flag. See issue #9516.
* No /fast targets in try_compile project modeBrad King2009-08-041-2/+3
| | | | | | | | The try_compile command builds the cmTryCompileExec executable using the cmTryCompileExec/fast target with Makefile generators in order to save time since dependencies are not needed. However, in project mode the command builds an entire source tree that may have dependencies. Therefore we can use the /fast target approach only in one-source mode.
* Test try_compile project modeBrad King2009-08-031-0/+7
| | | | | | | The try_compile command project mode builds an entire source tree instead of one source file. It uses an existing CMakeLists.txt file in the given source tree instead of generating one. This commit creates a test for the mode in the TryCompile test.
* ENH: remove test that does not work on all compilersBill Hoffman2008-07-161-32/+0
|
* ENH: add a test for bug 7316Bill Hoffman2008-07-151-0/+33
|
* ENH: preclean some warningsKen Martin2008-03-251-0/+1
|
* ENH: add tests for check_c_source_runs(), check_cxx_source_runs(),Alexander Neundorf2007-07-311-0/+56
| | | | | | | | check_c_source_compiles() and check_cxx_source_compiles() -TRY_RUN in crosscompiling mode: copy the created executables to CMAKE_BINARY_DIR so the user can run them manually on the target Alex
* ENH: improve TRY_RUN() for crosscompiling: instead of just failing, it nowAlexander Neundorf2007-06-011-2/+27
| | | | | | | | | | | | | | | creates two cache variables, one for the RUN_RESULT, one for the RUN_OUTPUT (if required), which can be set or preset by the user. It has now also two new arguments: RUN_OUTPUT_VARIABLE and COMPILE_OUTPUT_VARIABLE (the old OUTPUT_VARIABLE merges both), so if only COMPILE_OUTPUT_VARIABLE is used the run time output of the TRY_RUN is unused and the user doesn't have to care about the output when crosscompiling. This is now used in FindThreads.cmake, CheckC/CXXSourceRuns.cmake and TestBigEndian.cmake, which used the output only for the logfile (compile output is still there). Test/TryCompile/ now also tests the behaviour of OUTPUT_VARIABLE, RUN_OUTPUT_VARIABLE and COMPILE_OUTPUT_VARIABLE. Alex
* ENH: add COPY_FILE argument to TRY_COMPILE, so the compiled executable canAlexander Neundorf2007-05-241-1/+10
| | | | | | be used e.g. for getting strings out of it. Alex
* ENH: add two simple tests for TRY_RUN()Alexander Neundorf2007-05-241-2/+30
| | | | | | | | STYLE: create a new base class cmCoreTryCompile, from which cmTryCompileCommand and cmTryRunCommand are derived, so there are no public static functions with lots of arguments anymore Alex
* ENH: add more output when test failsBill Hoffman2007-01-311-4/+4
|
* ENH: centralized locaiton of CMakeFiles settingKen Martin2006-06-141-6/+6
|
* ENH: put CmakeTmp into CMakeFilesKen Martin2006-01-121-6/+8
|
* BUG: dont put the output of a try compile in the output because visual ↵Bill Hoffman2004-05-201-6/+0
| | | | stduio 7 ide will thing there were errors
* ENH: add more testing for ansi for scopesBill Hoffman2003-02-111-1/+26
|
* ENH: add a new test for TRY_COMPILEBill Hoffman2003-02-101-9/+10
|
* ENH: add a new test to test try compileBill Hoffman2003-02-101-0/+53