CMakeLists.txt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Copyright 2010 Jukka Jylänki
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. # http://www.apache.org/licenses/LICENSE-2.0
  6. # Unless required by applicable law or agreed to in writing, software
  7. # distributed under the License is distributed on an "AS IS" BASIS,
  8. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. # See the License for the specific language governing permissions and
  10. # limitations under the License.
  11. # Modified by Lasse Oorni and Yao Wei Tjong for Urho3D
  12. #set (TARGET_NAME kNet)
  13. include_directories(include)
  14. file (GLOB kNetSourceFiles src/*.cpp)
  15. file (GLOB kNetHeaderFiles include/*.h include/kNet/*.h include/kNet/*.inl)
  16. if (WIN32)
  17. file (GLOB kNetWin32SourceFiles src/win32/*.cpp)
  18. file (GLOB kNetWin32HeaderFiles include/kNet/win32/*.h)
  19. if (USE_BOOST)
  20. list (REMOVE_ITEM kNetWin32SourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/win32/W32Thread.cpp)
  21. endif ()
  22. list (APPEND kNetSourceFiles ${kNetWin32SourceFiles})
  23. list (APPEND kNetHeaderFiles ${kNetWin32HeaderFiles})
  24. add_definitions (-D_WINSOCKAPI_)
  25. add_definitions (-D_CRT_SECURE_NO_WARNINGS)
  26. add_definitions (-DKNET_MEMORY_LEAK_CHECK)
  27. elseif (UNIX)
  28. file (GLOB kNetUnixSourceFiles src/unix/*.cpp)
  29. file (GLOB kNetUnixHeaderFiles include/*.h include/kNet/*.h include/kNet/unix/*.h)
  30. if (USE_BOOST)
  31. list (REMOVE_ITEM kNetUnixSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/unix/UnixThread.cpp)
  32. endif ()
  33. list (APPEND kNetSourceFiles ${kNetUnixSourceFiles})
  34. list (APPEND kNetHeaderFiles ${kNetUnixHeaderFiles})
  35. add_definitions (-DKNET_UNIX)
  36. endif ()
  37. # Urho3D: set DEBUG_CPP_NAME only on Windows, Xcode project file can not be opened if this is included
  38. if (WIN32)
  39. foreach (srcFile ${kNetSourceFiles})
  40. get_filename_component (baseName ${srcFile} NAME)
  41. set_source_files_properties (${srcFile} PROPERTIES COMPILE_FLAGS "-DDEBUG_CPP_NAME=\"\\\"${baseName}\"\\\"")
  42. endforeach ()
  43. endif ()
  44. # Define source files
  45. set (SOURCE_FILES ${kNetSourceFiles} ${kNetHeaderFiles})
  46. add_library(kNet ${SOURCE_FILES})