CMakeLists.txt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #
  2. # Example CMakeLists.txt file to demonstrate how to make a designable Windows Forms project with CMake.
  3. #
  4. # Code modifications and example by John Farrier, [email protected]
  5. #
  6. cmake_minimum_required(VERSION 2.8.10)
  7. # Project Name
  8. project(VSWindowsFormsResx CXX)
  9. include(CheckFunctionExists)
  10. include(CheckCXXSourceCompiles)
  11. include(CheckIncludeFile)
  12. # Note: The designable form is assumed to have a .h extension as is default in Visual Studio.
  13. # 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
  14. set(TARGET_H
  15. WindowsFormsResx/MyForm.h
  16. WindowsFormsResx/Header.h
  17. )
  18. set(TARGET_SRC
  19. WindowsFormsResx/MyForm.cpp
  20. WindowsFormsResx/Source.cpp
  21. )
  22. set(TARGET_RESX
  23. WindowsFormsResx/MyForm.resx
  24. )
  25. set(TARGET_LIBRARIES ${SYSLIBS})
  26. add_executable(${PROJECT_NAME} ${TARGET_SRC} ${TARGET_H} ${TARGET_RESX})
  27. # Note: The property VS_GLOBAL_KEYWORD must be set.
  28. set_property(TARGET ${PROJECT_NAME} PROPERTY VS_GLOBAL_KEYWORD "ManagedCProj")
  29. # Note: The property VS_DOTNET_REFERENCES must be set.
  30. set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_REFERENCES "System" "System.Data" "System.Drawing" "System.Windows.Forms" "System.Xml")
  31. # Note: Modification of compiler flags is required for CLR compatibility now that we are using .resx files.
  32. string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  33. string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")