BUG: Fix find_* search order with path suffixes
[cmake.git] / Source / cmTryCompileCommand.h
blob2ed6f5ffac3157c8c35c01ee16b7e3caf891c538
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmTryCompileCommand.h,v $
5 Language: C++
6 Date: $Date: 2008-01-23 15:27:59 $
7 Version: $Revision: 1.27 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmTryCompileCommand_h
18 #define cmTryCompileCommand_h
20 #include "cmCoreTryCompile.h"
22 /** \class cmTryCompileCommand
23 * \brief Specifies where to install some files
25 * cmTryCompileCommand is used to test if soucre code can be compiled
27 class cmTryCompileCommand : public cmCoreTryCompile
29 public:
30 /**
31 * This is a virtual constructor for the command.
33 virtual cmCommand* Clone()
35 return new cmTryCompileCommand;
38 /**
39 * This is called when the command is first encountered in
40 * the CMakeLists.txt file.
42 virtual bool InitialPass(std::vector<std::string> const& args,
43 cmExecutionStatus &status);
45 /**
46 * The name of the command as specified in CMakeList.txt.
48 virtual const char* GetName() { return "try_compile";}
50 /**
51 * Succinct documentation.
53 virtual const char* GetTerseDocumentation()
55 return "Try compiling some code.";
58 /**
59 * More documentation. */
60 virtual const char* GetFullDocumentation()
62 return
63 " try_compile(RESULT_VAR bindir srcdir\n"
64 " projectName <targetname> [CMAKE_FLAGS <Flags>]\n"
65 " [OUTPUT_VARIABLE var])\n"
66 "Try compiling a program. In this form, srcdir should contain a "
67 "complete CMake project with a CMakeLists.txt file and all sources. The "
68 "bindir and srcdir will not be deleted after this command is run. "
69 "If <target name> is specified then build just that target "
70 "otherwise the all or ALL_BUILD target is built.\n"
71 " try_compile(RESULT_VAR bindir srcfile\n"
72 " [CMAKE_FLAGS <Flags>]\n"
73 " [COMPILE_DEFINITIONS <flags> ...]\n"
74 " [OUTPUT_VARIABLE var]\n"
75 " [COPY_FILE <filename> )\n"
76 "Try compiling a srcfile. In this case, the user need only supply a "
77 "source file. CMake will create the appropriate CMakeLists.txt file "
78 "to build the source. If COPY_FILE is used, the compiled file will be "
79 "copied to the given file.\n"
80 "In this version all files in bindir/CMakeFiles/CMakeTmp, "
81 "will be cleaned automatically, for debugging a --debug-trycompile can "
82 "be passed to cmake to avoid the clean. Some extra flags that "
83 " can be included are, "
84 "INCLUDE_DIRECTORIES, LINK_DIRECTORIES, and LINK_LIBRARIES. "
85 "COMPILE_DEFINITIONS are -Ddefinition that will be passed to the "
86 "compile line. "
88 "try_compile creates a CMakeList.txt "
89 "file on the fly that looks like this:\n"
90 " add_definitions( <expanded COMPILE_DEFINITIONS from calling "
91 "cmake>)\n"
92 " include_directories(${INCLUDE_DIRECTORIES})\n"
93 " link_directories(${LINK_DIRECTORIES})\n"
94 " add_executable(cmTryCompileExec sources)\n"
95 " target_link_libraries(cmTryCompileExec ${LINK_LIBRARIES})\n"
96 "In both versions of the command, "
97 "if OUTPUT_VARIABLE is specified, then the "
98 "output from the build process is stored in the given variable. "
99 "Return the success or failure in "
100 "RESULT_VAR. CMAKE_FLAGS can be used to pass -DVAR:TYPE=VALUE flags "
101 "to the cmake that is run during the build. "
105 cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile);
110 #endif