try_compile: Add option to control type of target

Create a `CMAKE_TRY_COMPILE_TARGET_TYPE` option to specify use
of `add_library(... STATIC ...)` for the generated test project.
This will be useful for cross-compiling toolchains that cannot
link a binary without custom flags or scripts.
This commit is contained in:
Brad King
2016-02-19 13:23:48 -05:00
parent 509b1f08ea
commit 7f1bd9fe69
15 changed files with 136 additions and 15 deletions

View File

@@ -30,7 +30,7 @@ public:
* commands, such as TryRun can access the same logic without
* duplication.
*/
int TryCompileCode(std::vector<std::string> const& argv);
int TryCompileCode(std::vector<std::string> const& argv, bool isTryRun);
/**
* This deletes all the files created by TryCompileCode.
@@ -44,8 +44,8 @@ public:
TryCompileCode. The result is stored in OutputFile. If nothing is found,
the error message is stored in FindErrorMessage.
*/
void FindOutputFile(const std::string& targetName);
void FindOutputFile(const std::string& targetName,
cmState::TargetType targetType);
cmTypeMacro(cmCoreTryCompile, cmCommand);