summaryrefslogtreecommitdiffstats
path: root/Tests/Module
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-05-23 05:44:04 (GMT)
committerBrad King <brad.king@kitware.com>2013-05-24 13:09:43 (GMT)
commit7e24997fedbcaa4f1db8e295ca1845dadf50ff55 (patch)
treed46976d08b2964873f9668e3a18ffb39e55dd4e1 /Tests/Module
parent3db29d2724b9ed6cbbf5e2af668ecfb6ec365a3b (diff)
downloadCMake-7e24997fedbcaa4f1db8e295ca1845dadf50ff55.zip
CMake-7e24997fedbcaa4f1db8e295ca1845dadf50ff55.tar.gz
CMake-7e24997fedbcaa4f1db8e295ca1845dadf50ff55.tar.bz2
GenerateExportHeader: Generate only C identifiers as defines
The variables in this module are used to configure a header file with defines whose name depends on the name of the target. As valid names of targets may be invalid for use as defines, convert the names of the defines used to C identifiers first. This is already done in C++ code for the DEFINE_SYMBOL property. This is not as simple as ensuring that the BASE_NAME is a C identifier, because most of the define names are configurable, and because use of a BASE_NAME which is not a C identifier, such as 4square can become a C identifier by specifying a prefix in the generate_export_header macro.
Diffstat (limited to 'Tests/Module')
-rw-r--r--Tests/Module/GenerateExportHeader/CMakeLists.txt3
-rw-r--r--Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt13
-rw-r--r--Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp7
-rw-r--r--Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h13
-rw-r--r--Tests/Module/GenerateExportHeader/c_identifier/main.cpp8
5 files changed, 44 insertions, 0 deletions
diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt
index 4a5b1cb..cc954ff 100644
--- a/Tests/Module/GenerateExportHeader/CMakeLists.txt
+++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt
@@ -168,6 +168,9 @@ add_subdirectory(lib_shared_and_statictest)
add_subdirectory(override_symbol)
add_subdirectory(nodeprecated)
add_subdirectory(prefix)
+if(NOT BORLAND)
+ add_subdirectory(c_identifier)
+endif()
if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang))
# We deliberately call deprecated methods, and test for that elsewhere.
diff --git a/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt b/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt
new file mode 100644
index 0000000..9f8c8ef
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/c_identifier/CMakeLists.txt
@@ -0,0 +1,13 @@
+project(c_identifier)
+
+set(c_identifier_lib_SRCS
+ c_identifier_class.cpp
+)
+
+add_library(7c-identifier-lib++ SHARED c_identifier_class.cpp)
+
+generate_export_header(7c-identifier-lib++)
+
+add_executable(c_identifier_exe main.cpp)
+
+target_link_libraries(c_identifier_exe 7c-identifier-lib++)
diff --git a/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp
new file mode 100644
index 0000000..d252c8e
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.cpp
@@ -0,0 +1,7 @@
+
+#include "c_identifier_class.h"
+
+int CIdentifierClass::someMethod() const
+{
+ return 0;
+}
diff --git a/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h
new file mode 100644
index 0000000..741efdc
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/c_identifier/c_identifier_class.h
@@ -0,0 +1,13 @@
+
+#ifndef C_IDENTIFIER_CLASS_H
+#define C_IDENTIFIER_CLASS_H
+
+#include "7c-identifier-lib++_export.h"
+
+class _7C_IDENTIFIER_LIB___EXPORT CIdentifierClass
+{
+public:
+ int someMethod() const;
+};
+
+#endif
diff --git a/Tests/Module/GenerateExportHeader/c_identifier/main.cpp b/Tests/Module/GenerateExportHeader/c_identifier/main.cpp
new file mode 100644
index 0000000..68beebb
--- /dev/null
+++ b/Tests/Module/GenerateExportHeader/c_identifier/main.cpp
@@ -0,0 +1,8 @@
+
+#include "c_identifier_class.h"
+
+int main(int argc, char **argv)
+{
+ CIdentifierClass cic;
+ return cic.someMethod();
+}