CMakeLists.txt 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. # ATOMIC: Disable KNET_MEMORY_LEAK_CHECK, only used on Windows
  27. # redefines new/delete and causes a compilation problem on VS2015 Update 1
  28. # add_definitions (-DKNET_MEMORY_LEAK_CHECK)
  29. elseif (UNIX)
  30. file (GLOB kNetUnixSourceFiles src/unix/*.cpp)
  31. file (GLOB kNetUnixHeaderFiles include/*.h include/kNet/*.h include/kNet/unix/*.h)
  32. if (USE_BOOST)
  33. list (REMOVE_ITEM kNetUnixSourceFiles ${CMAKE_CURRENT_SOURCE_DIR}/src/unix/UnixThread.cpp)
  34. endif ()
  35. list (APPEND kNetSourceFiles ${kNetUnixSourceFiles})
  36. list (APPEND kNetHeaderFiles ${kNetUnixHeaderFiles})
  37. add_definitions (-DKNET_UNIX)
  38. endif ()
  39. # Urho3D: set DEBUG_CPP_NAME only on Windows, Xcode project file can not be opened if this is included
  40. if (WIN32)
  41. foreach (srcFile ${kNetSourceFiles})
  42. get_filename_component (baseName ${srcFile} NAME)
  43. set_source_files_properties (${srcFile} PROPERTIES COMPILE_FLAGS "-DDEBUG_CPP_NAME=\"\\\"${baseName}\"\\\"")
  44. endforeach ()
  45. endif ()
  46. # Define source files
  47. set (SOURCE_FILES ${kNetSourceFiles} ${kNetHeaderFiles})
  48. add_library(kNet ${SOURCE_FILES})