[Cmake-commits] CMake branch, master, updated. v3.12.0-rc1-45-gb0b99d8
Kitware Robot
kwrobot at kitware.com
Mon Jun 18 10:15:09 EDT 2018
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, master has been updated
via b0b99d877e92028a0265ac86d1d6c79276a04811 (commit)
via a75638c1301df84de6af61cff2acd781c59cafa2 (commit)
via 5262215c67f5e9f9c47a9a10acb526c8ee4b058b (commit)
via c76c1ea2086a071c0afb143918b275bb8cf3b806 (commit)
via 4eae1c081693187925b47df251038e35e43bb014 (commit)
via f3cd44263ed4640b7092e0d280e153894a38fc9e (commit)
via 08f2a2408d1b5a4c5deff7deea4f923616fea717 (commit)
from fe447879dd517916796accfdbb4f2b5feb82a56f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b0b99d877e92028a0265ac86d1d6c79276a04811
commit b0b99d877e92028a0265ac86d1d6c79276a04811
Merge: a75638c c76c1ea
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Jun 18 14:08:01 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Jun 18 10:08:54 2018 -0400
Merge topic 'find_program-conditional-cwd'
c76c1ea208 find_program: Consider CWD only for paths with separator
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2120
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a75638c1301df84de6af61cff2acd781c59cafa2
commit a75638c1301df84de6af61cff2acd781c59cafa2
Merge: 5262215 4eae1c0
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Jun 18 14:06:27 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Jun 18 10:07:38 2018 -0400
Merge topic 'update-kwsys'
4eae1c0816 Merge branch 'upstream-KWSys' into update-kwsys
f3cd44263e KWSys 2018-06-14 (2b0ca1d8)
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2148
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5262215c67f5e9f9c47a9a10acb526c8ee4b058b
commit 5262215c67f5e9f9c47a9a10acb526c8ee4b058b
Merge: fe44787 08f2a24
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Jun 18 14:05:38 2018 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Jun 18 10:06:29 2018 -0400
Merge topic 'UseSWIG-bugfixes'
08f2a2408d UseSWIG: add support of target property INCLUDE_DIRECTORIES consumption
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !2141
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c76c1ea2086a071c0afb143918b275bb8cf3b806
commit c76c1ea2086a071c0afb143918b275bb8cf3b806
Author: Sam Yates <halfflat at gmail.com>
AuthorDate: Thu May 31 19:00:45 2018 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 14 14:28:03 2018 -0400
find_program: Consider CWD only for paths with separator
find_program() incorrectly prepended search path components
to absolute file paths, and incorrectly searched the current
working directory for files that contained no directory
separators.
* Replace calls cmFindProgramHelper::CheckDirectory(std::string())
with call of new method cmFindProgramHelper::CheckCompoundNames()
that checks for the presence of a directory separator in the
file name.
* Use cmSystemTools::CollapseCombinedPath rather than string
concatenation to properly combine absolute file names with
search path components.
* Add unit tests to verify corrections.
Fixes: #18044
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 13a18e2..db34077 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -34,6 +34,9 @@ struct cmFindProgramHelper
// Current names under consideration.
std::vector<std::string> Names;
+ // Current name with extension under consideration.
+ std::string TestNameExt;
+
// Current full path under consideration.
std::string TestPath;
@@ -43,6 +46,19 @@ struct cmFindProgramHelper
this->Names.clear();
this->AddName(name);
}
+ bool CheckCompoundNames()
+ {
+ for (std::string const& n : this->Names) {
+ // Only perform search relative to current directory if the file name
+ // contains a directory separator.
+ if (n.find('/') != std::string::npos) {
+ if (this->CheckDirectoryForName("", n)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
bool CheckDirectory(std::string const& path)
{
for (std::string const& n : this->Names) {
@@ -55,14 +71,16 @@ struct cmFindProgramHelper
bool CheckDirectoryForName(std::string const& path, std::string const& name)
{
for (std::string const& ext : this->Extensions) {
- this->TestPath = path;
- this->TestPath += name;
if (!ext.empty() && cmSystemTools::StringEndsWith(name, ext.c_str())) {
continue;
}
- this->TestPath += ext;
+ this->TestNameExt = name;
+ this->TestNameExt += ext;
+ this->TestPath =
+ cmSystemTools::CollapseCombinedPath(path, this->TestNameExt);
+
if (cmSystemTools::FileExists(this->TestPath, true)) {
- this->BestPath = cmSystemTools::CollapseFullPath(this->TestPath);
+ this->BestPath = this->TestPath;
return true;
}
}
@@ -145,8 +163,8 @@ std::string cmFindProgramCommand::FindNormalProgramNamesPerDir()
helper.AddName(n);
}
- // Check for the names themselves (e.g. absolute paths).
- if (helper.CheckDirectory(std::string())) {
+ // Check for the names themselves if they contain a directory separator.
+ if (helper.CheckCompoundNames()) {
return helper.BestPath;
}
@@ -168,8 +186,8 @@ std::string cmFindProgramCommand::FindNormalProgramDirsPerName()
// Switch to searching for this name.
helper.SetName(n);
- // Check for the name by itself (e.g. an absolute path).
- if (helper.CheckDirectory(std::string())) {
+ // Check for the names themselves if they contain a directory separator.
+ if (helper.CheckCompoundNames()) {
return helper.BestPath;
}
diff --git a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt
new file mode 100644
index 0000000..cb3c99f
--- /dev/null
+++ b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt
@@ -0,0 +1,6 @@
+-- PROG_ABS='PROG_ABS-NOTFOUND'
+-- PROG_ABS_NPD='PROG_ABS_NPD-NOTFOUND'
+-- PROG_CWD='PROG_CWD-NOTFOUND'
+-- PROG_CWD_NPD='PROG_CWD_NPD-NOTFOUND'
+-- PROG_CWD_DOT='[^']*/Tests/RunCMake/find_program/testCWD'
+-- PROG_CWD_DOT_NPD='[^']*/Tests/RunCMake/find_program/testCWD'
diff --git a/Tests/RunCMake/find_program/RelAndAbsPath.cmake b/Tests/RunCMake/find_program/RelAndAbsPath.cmake
new file mode 100644
index 0000000..9a42c5e
--- /dev/null
+++ b/Tests/RunCMake/find_program/RelAndAbsPath.cmake
@@ -0,0 +1,63 @@
+# testNoSuchFile should only be found if the file absolute path is
+# incorrectly prepended with the search path.
+
+function(strip_windows_path_prefix p outvar)
+ if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+ string(REGEX REPLACE "^.:" "" p "${p}")
+ endif()
+ set(${outvar} "${p}" PARENT_SCOPE)
+endfunction()
+
+strip_windows_path_prefix("${CMAKE_CURRENT_SOURCE_DIR}" srcdir)
+
+file(MAKE_DIRECTORY "tmp${srcdir}")
+configure_file(testCWD "tmp${srcdir}/testNoSuchFile" COPYONLY)
+
+find_program(PROG_ABS
+ NAMES "${srcdir}/testNoSuchFile"
+ PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp"
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_ABS='${PROG_ABS}'")
+
+find_program(PROG_ABS_NPD
+ NAMES "${srcdir}/testNoSuchFile"
+ PATHS "${CMAKE_CURRENT_BINARY_DIR}/tmp"
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_ABS_NPD='${PROG_ABS_NPD}'")
+
+# ./testCWD should not be found without '.' being in the path list.
+
+configure_file(testCWD testCWD COPYONLY)
+
+find_program(PROG_CWD
+ NAMES testCWD
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD='${PROG_CWD}'")
+
+find_program(PROG_CWD_NPD
+ NAMES testCWD
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_NPD='${PROG_CWD_NPD}'")
+
+# Confirm that adding '.' to path does locate ./testCWD.
+
+find_program(PROG_CWD_DOT
+ NAMES testCWD
+ PATHS .
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_DOT='${PROG_CWD_DOT}'")
+
+find_program(PROG_CWD_DOT_NPD
+ NAMES testCWD
+ PATHS .
+ NAMES_PER_DIR
+ NO_DEFAULT_PATH
+ )
+message(STATUS "PROG_CWD_DOT_NPD='${PROG_CWD_DOT_NPD}'")
diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake
index 89307c1..6903f05 100644
--- a/Tests/RunCMake/find_program/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake
@@ -3,6 +3,7 @@ include(RunCMake)
run_cmake(EnvAndHints)
run_cmake(DirsPerName)
run_cmake(NamesPerDir)
+run_cmake(RelAndAbsPath)
if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$")
run_cmake(WindowsCom)
diff --git a/Tests/RunCMake/find_program/testCWD b/Tests/RunCMake/find_program/testCWD
new file mode 100755
index 0000000..1a24852
--- /dev/null
+++ b/Tests/RunCMake/find_program/testCWD
@@ -0,0 +1 @@
+#!/bin/sh
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4eae1c081693187925b47df251038e35e43bb014
commit 4eae1c081693187925b47df251038e35e43bb014
Merge: 65ee7d1 f3cd442
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 14 11:26:37 2018 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 14 11:26:37 2018 -0400
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys:
KWSys 2018-06-14 (2b0ca1d8)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3cd44263ed4640b7092e0d280e153894a38fc9e
commit f3cd44263ed4640b7092e0d280e153894a38fc9e
Author: KWSys Upstream <kwrobot at kitware.com>
AuthorDate: Thu Jun 14 08:41:42 2018 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 14 11:26:36 2018 -0400
KWSys 2018-06-14 (2b0ca1d8)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit 2b0ca1d85d6e3fcf3b3fa375783c33524629f256 (master).
Upstream Shortlog
-----------------
Marian Klymov (3):
0b9f51a1 Remove redundant calls to c_str
361e54e3 Get rid of redundant string initialization
61501133 SystemInformation: Avoid use of dangling pointers on Solaris
diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index cfe62b4..7545ec7 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -3495,7 +3495,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// Chip Model Name
this->ChipID.ModelName =
- this->ExtractValueFromCpuInfoFile(buffer, "model name").c_str();
+ this->ExtractValueFromCpuInfoFile(buffer, "model name");
// L1 Cache size
// Different architectures may show different names for the caches.
@@ -4613,7 +4613,7 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl(
std::string SystemInformationImplementation::RunProcess(
std::vector<const char*> args)
{
- std::string buffer = "";
+ std::string buffer;
// Run the application
kwsysProcess* gp = kwsysProcess_New();
@@ -4668,11 +4668,7 @@ std::string SystemInformationImplementation::RunProcess(
std::string SystemInformationImplementation::ParseValueFromKStat(
const char* arguments)
{
- std::vector<const char*> args;
- args.clear();
- args.push_back("kstat");
- args.push_back("-p");
-
+ std::vector<std::string> args_string;
std::string command = arguments;
size_t start = std::string::npos;
size_t pos = command.find(' ', 0);
@@ -4691,35 +4687,35 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
}
if (!inQuotes) {
- std::string arg = command.substr(start + 1, pos - start - 1);
+ args_string.push_back(command.substr(start + 1, pos - start - 1));
+ std::string& arg = args_string.back();
// Remove the quotes if any
- size_t quotes = arg.find('"');
- while (quotes != std::string::npos) {
- arg.erase(quotes, 1);
- quotes = arg.find('"');
- }
- args.push_back(arg.c_str());
+ arg.erase(std::remove(arg.begin(), arg.end(), '"'), arg.end());
start = pos;
}
pos = command.find(' ', pos + 1);
}
- std::string lastArg = command.substr(start + 1, command.size() - start - 1);
- args.push_back(lastArg.c_str());
+ args_string.push_back(command.substr(start + 1, command.size() - start - 1));
+ std::vector<const char*> args;
+ args.reserve(3 + args_string.size());
+ args.push_back("kstat");
+ args.push_back("-p");
+ for (size_t i = 0; i < args_string.size(); ++i) {
+ args.push_back(args_string[i].c_str());
+ }
args.push_back(KWSYS_NULLPTR);
std::string buffer = this->RunProcess(args);
- std::string value = "";
+ std::string value;
for (size_t i = buffer.size() - 1; i > 0; i--) {
if (buffer[i] == ' ' || buffer[i] == '\t') {
break;
}
if (buffer[i] != '\n' && buffer[i] != '\r') {
- std::string val = value;
- value = buffer[i];
- value += val;
+ value.insert(0u, 1, buffer[i]);
}
}
return value;
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 0079da2..b87b6b5 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -686,7 +686,7 @@ public:
for (iterator i = this->begin(); i != this->end(); ++i) {
# if defined(_WIN32)
const std::string s = Encoding::ToNarrow(*i);
- kwsysUnPutEnv(s.c_str());
+ kwsysUnPutEnv(s);
# else
kwsysUnPutEnv(*i);
# endif
@@ -1973,7 +1973,7 @@ std::string SystemTools::ConvertToUnixOutputPath(const std::string& path)
}
// escape spaces and () in the path
if (ret.find_first_of(" ") != std::string::npos) {
- std::string result = "";
+ std::string result;
char lastch = 1;
for (const char* ch = ret.c_str(); *ch != '\0'; ++ch) {
// if it is already escaped then don't try to escape it again
@@ -3140,7 +3140,7 @@ void SystemTools::AddTranslationPath(const std::string& a,
void SystemTools::AddKeepPath(const std::string& dir)
{
std::string cdir;
- Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir);
+ Realpath(SystemTools::CollapseFullPath(dir), cdir);
SystemTools::AddTranslationPath(cdir, dir);
}
diff --git a/testCommandLineArguments.cxx b/testCommandLineArguments.cxx
index 0385a3d..ef87436 100644
--- a/testCommandLineArguments.cxx
+++ b/testCommandLineArguments.cxx
@@ -77,7 +77,7 @@ int testCommandLineArguments(int argc, char* argv[])
int some_int_variable = 10;
double some_double_variable = 10.10;
char* some_string_variable = KWSYS_NULLPTR;
- std::string some_stl_string_variable = "";
+ std::string some_stl_string_variable;
bool some_bool_variable = false;
bool some_bool_variable1 = false;
bool bool_arg1 = false;
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index e6f9701..0477d59 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -206,7 +206,7 @@ static bool CheckFileOperations()
res = false;
}
- if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) {
+ if (!kwsys::SystemTools::Touch(testNewFile, true)) {
std::cerr << "Problem with Touch for: " << testNewFile << std::endl;
res = false;
}
@@ -415,7 +415,7 @@ static bool CheckFileOperations()
res = false;
}
- kwsys::SystemTools::Touch(testNewFile.c_str(), true);
+ kwsys::SystemTools::Touch(testNewFile, true);
if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) {
std::cerr << "Problem with RemoveADirectory for: " << testNewDir
<< std::endl;
@@ -806,7 +806,7 @@ static bool CheckFind()
const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" +
testFindFileName);
- if (!kwsys::SystemTools::Touch(testFindFile.c_str(), true)) {
+ if (!kwsys::SystemTools::Touch(testFindFile, true)) {
std::cerr << "Problem with Touch for: " << testFindFile << std::endl;
// abort here as the existence of the file only makes the test meaningful
return false;
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08f2a2408d1b5a4c5deff7deea4f923616fea717
commit 08f2a2408d1b5a4c5deff7deea4f923616fea717
Author: Marc Chevrier <marc.chevrier at gmail.com>
AuthorDate: Thu Jun 7 17:50:39 2018 +0200
Commit: Marc Chevrier <marc.chevrier at gmail.com>
CommitDate: Wed Jun 13 17:46:16 2018 +0200
UseSWIG: add support of target property INCLUDE_DIRECTORIES consumption
Fixes: #18003
diff --git a/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst b/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst
new file mode 100644
index 0000000..2a2721f
--- /dev/null
+++ b/Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst
@@ -0,0 +1,5 @@
+UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES
+--------------------------------------
+
+* Module ``UseSWIG`` gains capability to manage target property
+ :prop_tgt:`INCLUDE_DIRECTORIES` for ``SWIG`` compilation.
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 7127b8f..851101b 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -96,6 +96,13 @@ ensure generated files will receive the required settings.
:prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
:prop_sf:`COMPILE_OPTIONS`.
+``USE_TARGET_INCLUDE_DIRECTORIES``
+ If set to ``TRUE``, contents of target property
+ :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
+ If set to ``FALSE`` target property :prop_tgt:`INCLUDE_DIRECTORIES` will be
+ ignored. If not set, target property ``SWIG_USE_TARGT_INCLUDE_DIRECTORIES``
+ will be considered.
+
``GENERATED_INCLUDE_DIRECTORIES``, ``GENERATED_COMPILE_DEFINITIONS`` and ``GENERATED_COMPILE_OPTIONS``
Add custom flags to the C/C++ generated source. They will fill, respectively,
properties :prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
@@ -127,6 +134,13 @@ input files.
set_property(TARGET mymod PROPERTY SWIG_COMPILE_DEFINITIONS MY_DEF1 MY_DEF2)
set_property(TARGET mymod PROPERTY SWIG_COMPILE_OPTIONS -bla -blb)
+``SWIG_USE_TARGET_INCLUDE_DIRECTORIES``
+ If set to ``TRUE``, contents of target property
+ :prop_tgt:`INCLUDE_DIRECTORIES` will be forwarded to ``SWIG`` compiler.
+ If set to ``FALSE`` or not defined, target property
+ :prop_tgt:`INCLUDE_DIRECTORIES` will be ignored. This behavior can be
+ overridden by specifying source property ``USE_TARGET_INCLUDE_DIRECTORIES``.
+
``SWIG_GENERATED_INCLUDE_DIRECTORIES``, ``SWIG_GENERATED_COMPILE_DEFINITIONS`` and ``SWIG_GENERATED_COMPILE_OPTIONS``
These properties will populate, respectively, properties
:prop_sf:`INCLUDE_DIRECTORIES`, :prop_sf:`COMPILE_DEFINITIONS` and
@@ -310,6 +324,14 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
endif()
set (property "$<TARGET_PROPERTY:${name},SWIG_INCLUDE_DIRECTORIES>")
list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:$<TARGET_GENEX_EVAL:${name},${property}>,$<SEMICOLON>-I>>")
+ set (property "$<TARGET_PROPERTY:${name},INCLUDE_DIRECTORIES>")
+ get_source_file_property(use_target_include_dirs "${infile}" USE_TARGET_INCLUDE_DIRECTORIES)
+ if (use_target_include_dirs)
+ list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
+ elseif(use_target_include_dirs STREQUAL "NOTFOUND")
+ # not defined at source level, rely on target level
+ list (APPEND swig_source_file_flags "$<$<AND:$<BOOL:$<TARGET_PROPERTY:${name},SWIG_USE_TARGET_INCLUDE_DIRECTORIES>>,$<BOOL:${property}>>:-I$<JOIN:${property},$<SEMICOLON>-I>>")
+ endif()
set (property "$<TARGET_PROPERTY:${name},SWIG_COMPILE_DEFINITIONS>")
list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-D$<JOIN:$<TARGET_GENEX_EVAL:${name},${property}>,$<SEMICOLON>-D>>")
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index cc29b77..4c3d901 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -88,3 +88,14 @@ add_test(NAME UseSWIG.ModuleVersion2 COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+
+
+add_test(NAME UseSWIG.UseTargetINCLUDE_DIRECTORIES COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES"
+ ${build_generator_args}
+ --build-project TestModuleVersion2
+ --build-options ${build_options}
+ )
diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
new file mode 100644
index 0000000..3e266c3
--- /dev/null
+++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestUseTargetINCLUDE_DIRECTORIES CXX)
+
+include(CTest)
+
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+
+find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
+
+unset(CMAKE_SWIG_FLAGS)
+
+set_property(SOURCE "example.i" PROPERTY CPLUSPLUS ON)
+set_property(SOURCE "example.i" PROPERTY COMPILE_OPTIONS -includeall)
+
+swig_add_library(example1
+ LANGUAGE python
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ SOURCES example.i ../example.cxx)
+set_target_properties (example1 PROPERTIES
+ INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.."
+ SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE
+ OUTPUT_NAME example1
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1")
+target_link_libraries(example1 PRIVATE Python3::Python)
+
+
+# Check that source property override target property
+set_property(SOURCE "example.i" PROPERTY USE_TARGET_INCLUDE_DIRECTORIES TRUE)
+
+swig_add_library(example2
+ LANGUAGE python
+ OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ SOURCES example.i ../example.cxx)
+set_target_properties (example2 PROPERTIES
+ INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.."
+ SWIG_USE_TARGET_INCLUDE_DIRECTORIES FALSE
+ OUTPUT_NAME example2
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2")
+target_link_libraries(example2 PRIVATE Python3::Python)
diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i
new file mode 100644
index 0000000..fbdf724
--- /dev/null
+++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/example.i
@@ -0,0 +1,9 @@
+/* File : example.i */
+%module example
+
+%{
+#include "example.h"
+%}
+
+/* Let's just grab the original header file here */
+%include "example.h"
-----------------------------------------------------------------------
Summary of changes:
.../dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst | 5 ++
Modules/UseSWIG.cmake | 22 ++++++++
Source/cmFindProgramCommand.cxx | 34 +++++++++---
Source/kwsys/SystemInformation.cxx | 36 ++++++-------
Source/kwsys/SystemTools.cxx | 6 +--
Source/kwsys/testCommandLineArguments.cxx | 2 +-
Source/kwsys/testSystemTools.cxx | 6 +--
.../RunCMake/find_program/RelAndAbsPath-stdout.txt | 6 +++
Tests/RunCMake/find_program/RelAndAbsPath.cmake | 63 ++++++++++++++++++++++
Tests/RunCMake/find_program/RunCMakeTest.cmake | 1 +
Tests/RunCMake/find_program/{B/testB => testCWD} | 0
Tests/UseSWIG/CMakeLists.txt | 11 ++++
.../UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt | 45 ++++++++++++++++
.../{ => UseTargetINCLUDE_DIRECTORIES}/example.i | 0
14 files changed, 202 insertions(+), 35 deletions(-)
create mode 100644 Help/release/dev/UseSWIG-USE_TARGET_INCLUDE_DIRECTORIES.rst
create mode 100644 Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt
create mode 100644 Tests/RunCMake/find_program/RelAndAbsPath.cmake
copy Tests/RunCMake/find_program/{B/testB => testCWD} (100%)
create mode 100644 Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
copy Tests/UseSWIG/{ => UseTargetINCLUDE_DIRECTORIES}/example.i (100%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list