diff options
author | Brad King <brad.king@kitware.com> | 2021-02-25 14:04:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-02-25 14:04:20 (GMT) |
commit | c06a6ba61a9aaa5a802078e9d9217ddf1936f116 (patch) | |
tree | 636530de3c5468df22cae34faae93bb189270c14 | |
parent | 4250c5f91b67a84318c31485a2ab36ab64967f21 (diff) | |
parent | 136608dfec0552d5a49f4f414e6cafa920b53828 (diff) | |
download | CMake-c06a6ba61a9aaa5a802078e9d9217ddf1936f116.zip CMake-c06a6ba61a9aaa5a802078e9d9217ddf1936f116.tar.gz CMake-c06a6ba61a9aaa5a802078e9d9217ddf1936f116.tar.bz2 |
Merge topic 'create-test-source-list-duplicate-decls'
136608dfec cmCreateTestSourceList: avoid generating duplicate declarations
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5856
-rw-r--r-- | Source/cmCreateTestSourceList.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 3001ae0..a2fac73 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -90,10 +90,15 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args, std::replace(func_name.begin(), func_name.end(), ' ', '_'); std::replace(func_name.begin(), func_name.end(), '/', '_'); std::replace(func_name.begin(), func_name.end(), ':', '_'); + bool already_declared = + std::find(tests_func_name.begin(), tests_func_name.end(), func_name) != + tests_func_name.end(); tests_func_name.push_back(func_name); - forwardDeclareCode += "int "; - forwardDeclareCode += func_name; - forwardDeclareCode += "(int, char*[]);\n"; + if (!already_declared) { + forwardDeclareCode += "int "; + forwardDeclareCode += func_name; + forwardDeclareCode += "(int, char*[]);\n"; + } } std::string functionMapCode; |