summaryrefslogtreecommitdiff
path: root/Tests/VSMidl
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 15:39:57 -0700
committerAnas Nashif <anas.nashif@intel.com>2012-10-30 15:39:57 -0700
commit035c7fabc3b82cbc9a346c11abe2e9462b4c0379 (patch)
tree7e40f5a790eae329a8c5d3e59f046451767956ff /Tests/VSMidl
downloadcmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.gz
cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.bz2
cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.zip
Imported Upstream version 2.8.9upstream/2.8.9
Diffstat (limited to 'Tests/VSMidl')
-rw-r--r--Tests/VSMidl/CMakeLists.txt81
-rw-r--r--Tests/VSMidl/src/CMakeLists.txt12
-rw-r--r--Tests/VSMidl/src/main.cpp17
-rw-r--r--Tests/VSMidl/src/test.idl30
4 files changed, 140 insertions, 0 deletions
diff --git a/Tests/VSMidl/CMakeLists.txt b/Tests/VSMidl/CMakeLists.txt
new file mode 100644
index 000000000..432506c3b
--- /dev/null
+++ b/Tests/VSMidl/CMakeLists.txt
@@ -0,0 +1,81 @@
+# This CMakeLists.txt file exists solely to drive the one found in the "src"
+# subdir as an ExternalProject build. The project in "src" cannot build when
+# there is a space in the directory name, so we copy that directory to a place
+# guaranteed not to have a space in the name, build it there, and then copy the
+# resulting output directory back up here into this CMake test's build tree.
+#
+if(NOT DEFINED CMAKE_BUILDNAME)
+ string(REGEX REPLACE "^.*/([^/]+)/[^/]+/([^/]+)$" "\\1" CMAKE_BUILDNAME "${CMAKE_CURRENT_BINARY_DIR}")
+ string(REGEX REPLACE "^.*/([^/]+)/[^/]+/([^/]+)$" "\\2" THIS_TESTNAME "${CMAKE_CURRENT_BINARY_DIR}")
+ string(REPLACE " " "_" CMAKE_BUILDNAME "${CMAKE_BUILDNAME}")
+endif()
+message(STATUS "CMAKE_BUILDNAME='${CMAKE_BUILDNAME}'")
+message(STATUS "THIS_TESTNAME='${THIS_TESTNAME}'")
+
+cmake_minimum_required(VERSION 2.8)
+project(${THIS_TESTNAME})
+
+include(ExternalProject)
+
+if(NOT DEFINED HOME)
+ if(DEFINED ENV{CTEST_REAL_HOME})
+ set(HOME "$ENV{CTEST_REAL_HOME}")
+ else()
+ set(HOME "$ENV{HOME}")
+ endif()
+
+ if(NOT HOME AND WIN32)
+ # Try for USERPROFILE as HOME equivalent:
+ string(REPLACE "\\" "/" HOME "$ENV{USERPROFILE}")
+ endif()
+
+ # But just use root of SystemDrive if HOME contains any spaces:
+ # (Default on XP and earlier...)
+ if(HOME MATCHES " " AND WIN32)
+ string(REPLACE "\\" "/" HOME "$ENV{SystemDrive}")
+ endif()
+ if(HOME MATCHES " ")
+ set(HOME "")
+ endif()
+endif()
+message(STATUS "HOME='${HOME}'")
+
+if(NOT DEFINED url)
+ set(url "${CMAKE_CURRENT_SOURCE_DIR}/src")
+endif()
+message(STATUS "url='${url}'")
+
+set(base_dir "${HOME}/.cmake/Dashboards/${CMAKE_BUILDNAME}/${THIS_TESTNAME}")
+set(binary_dir "${base_dir}/build")
+set(source_dir "${base_dir}/src")
+
+# Source dir for this project exists in the CMake source tree, but we cannot
+# use it in-place since there might be a space in its directory name.
+# Source dir is therefore copied under a '.cmake/Dashboards'
+# dir in your HOME directory to give it a name with no spaces.
+#
+ExternalProject_Add(clean-${PROJECT_NAME}
+ DOWNLOAD_COMMAND ""
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${source_dir}"
+ BUILD_COMMAND ${CMAKE_COMMAND} -E remove_directory "${binary_dir}"
+ INSTALL_COMMAND ""
+ )
+
+ExternalProject_Add(download-${PROJECT_NAME}
+ URL "${url}"
+ SOURCE_DIR "${source_dir}"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ DEPENDS clean-${PROJECT_NAME}
+ )
+
+ExternalProject_Add(build-${PROJECT_NAME}
+ DOWNLOAD_COMMAND ""
+ SOURCE_DIR "${source_dir}"
+ BINARY_DIR "${binary_dir}"
+ INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
+ "${binary_dir}/${CMAKE_CFG_INTDIR}"
+ "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
+ DEPENDS download-${PROJECT_NAME}
+ )
diff --git a/Tests/VSMidl/src/CMakeLists.txt b/Tests/VSMidl/src/CMakeLists.txt
new file mode 100644
index 000000000..86c04ed98
--- /dev/null
+++ b/Tests/VSMidl/src/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 2.8)
+project(VSMidl)
+
+if(MSVC_VERSION GREATER 1200)
+ include_directories("${CMAKE_CURRENT_BINARY_DIR}/\$(IntDir)")
+else()
+ # midl generated headers end up directly in CMAKE_CURRENT_BINARY_DIR with
+ # VS6 builds.
+ include_directories("${CMAKE_CURRENT_BINARY_DIR}")
+endif()
+
+add_executable(VSMidl main.cpp test.idl)
diff --git a/Tests/VSMidl/src/main.cpp b/Tests/VSMidl/src/main.cpp
new file mode 100644
index 000000000..6b78fcc7f
--- /dev/null
+++ b/Tests/VSMidl/src/main.cpp
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <test.h>
+#include <test_i.c>
+
+int main(int argc, char** argv)
+{
+ IID libid = LIBID_CMakeMidlTestLib;
+ CLSID clsid = CLSID_CMakeMidlTest;
+ IID iid = IID_ICMakeMidlTest;
+
+ printf("Running '%s'\n", argv[0]);
+ printf(" libid starts with '0x%08lx'\n", (long) libid.Data1);
+ printf(" clsid starts with '0x%08lx'\n", (long) clsid.Data1);
+ printf(" iid starts with '0x%08lx'\n", (long) iid.Data1);
+
+ return 0;
+}
diff --git a/Tests/VSMidl/src/test.idl b/Tests/VSMidl/src/test.idl
new file mode 100644
index 000000000..fd755c789
--- /dev/null
+++ b/Tests/VSMidl/src/test.idl
@@ -0,0 +1,30 @@
+import "oaidl.idl";
+import "ocidl.idl";
+
+[
+ object,
+ uuid(258CCEBE-8EE4-4A48-B78C-AC53BCD59E28),
+ dual,
+ nonextensible,
+ helpstring("ICMakeTest Interface"),
+ pointer_default(unique)
+]
+interface ICMakeMidlTest : IUnknown
+{
+ [id(1), helpstring("method Method")] HRESULT Method();
+}
+
+[
+ uuid(0537BA59-7EEC-48F8-BD4B-369BC7D9807E),
+]
+library CMakeMidlTestLib
+{
+ [
+ uuid(D2A90807-019A-46E5-BF47-FF4FA4352D2A),
+ helpstring("CMakeMidlTest Class")
+ ]
+ coclass CMakeMidlTest
+ {
+ [default] interface ICMakeMidlTest;
+ };
+}