summaryrefslogtreecommitdiff
path: root/Tests/VSWindowsFormsResx/CMakeLists.txt
diff options
context:
space:
mode:
authorJohn Farrier <john.farrier@digitalinblue.com>2013-04-29 10:48:22 -0400
committerBrad King <brad.king@kitware.com>2013-05-16 13:06:44 -0400
commit79ec7868d0f08c9ff2e6fa6454b205132acecc24 (patch)
treea5526400e3ac907c10b42cfd28fbcd419a11a020 /Tests/VSWindowsFormsResx/CMakeLists.txt
parentc80594ba1274c3dc44c3f2efd70bd5c3d9066bf5 (diff)
downloadcmake-79ec7868d0f08c9ff2e6fa6454b205132acecc24.tar.gz
VS: Add Windows Forms Support
Add support to maintain designer functionality for Visual Studio C++ Windows Forms projects. Also add a test project showing how to use the CMakeLists.txt file and, when successfully configured, will allow use of the designer for the included form.
Diffstat (limited to 'Tests/VSWindowsFormsResx/CMakeLists.txt')
-rw-r--r--Tests/VSWindowsFormsResx/CMakeLists.txt44
1 files changed, 44 insertions, 0 deletions
diff --git a/Tests/VSWindowsFormsResx/CMakeLists.txt b/Tests/VSWindowsFormsResx/CMakeLists.txt
new file mode 100644
index 0000000000..a313ac2847
--- /dev/null
+++ b/Tests/VSWindowsFormsResx/CMakeLists.txt
@@ -0,0 +1,44 @@
+#
+# Example CMakeLists.txt file to demonstrate how to make a designable Windows Forms project with CMake.
+#
+# Code modifications and example by John Farrier, john.farrier@helleboreconsulting.com
+#
+
+cmake_minimum_required(VERSION 2.8.10)
+
+# Project Name
+project(VSWindowsFormsResx CXX)
+
+include(CheckFunctionExists)
+include(CheckCXXSourceCompiles)
+include(CheckIncludeFile)
+
+# Note: The designable form is assumed to have a .h extension as is default in Visual Studio.
+# Node: The designable form is assumed to have a .resx file with the same name and path (save extension) as is default in Visual Studio
+
+set(TARGET_H
+ WindowsFormsResx/MyForm.h
+ WindowsFormsResx/Header.h
+ )
+
+set(TARGET_SRC
+ WindowsFormsResx/MyForm.cpp
+ WindowsFormsResx/Source.cpp
+ )
+
+set(TARGET_RESX
+ WindowsFormsResx/MyForm.resx
+ )
+
+set(TARGET_LIBRARIES ${SYSLIBS})
+add_executable(${PROJECT_NAME} ${TARGET_SRC} ${TARGET_H} ${TARGET_RESX})
+
+# Note: The property VS_GLOBAL_KEYWORD must be set.
+set_property(TARGET ${PROJECT_NAME} PROPERTY VS_GLOBAL_KEYWORD "ManagedCProj")
+
+# Note: The property VS_DOTNET_REFERENCES must be set.
+set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_REFERENCES "System" "System.Data" "System.Drawing" "System.Windows.Forms" "System.Xml")
+
+# Note: Modification of compiler flags is required for CLR compatibility now that we are using .resx files.
+string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")