CMakeLists.txt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. cmake_minimum_required(VERSION 3.0)
  2. project(RaycastTrace VERSION 1.0.0)
  3. set(CMAKE_CXX_FLAGS "-static -static-libgcc -static-libstdc++ -Wall -Werror")
  4. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2 -DTSFUNCS_DEBUG=false")
  5. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -Og")
  6. add_definitions(-DPROJECT_NAME="${CMAKE_PROJECT_NAME}")
  7. add_definitions(-DPROJECT_EXPORT=${CMAKE_PROJECT_NAME})
  8. add_definitions(-DPROJECT_VERSION="${CMAKE_PROJECT_VERSION}")
  9. set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
  10. include_directories("include/")
  11. set(CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
  12. set(CMAKE_FIND_LIBRARY_SUFFIXES "" ".lib" ".a")
  13. find_library(MINHOOK_LIB_RELEASE_LOC
  14. NAMES minhook libminhook minhook.x32 minhook.x64
  15. PATHS ${TSFUNCS_LIBRARY_DIRS}
  16. REQUIRED
  17. )
  18. find_library(MINHOOK_LIB_DEBUG_LOC
  19. NAMES minhookd libminhookd minhook.x32d minhook.x64d
  20. PATHS ${TSFUNCS_LIBRARY_DIRS}
  21. REQUIRED
  22. )
  23. if (CMAKE_BUILD_TYPE STREQUAL "Debug")
  24. set(MINHOOK_LIB_LOC ${MINHOOK_LIB_DEBUG_LOC})
  25. else ()
  26. set(MINHOOK_LIB_LOC ${MINHOOK_LIB_RELEASE_LOC})
  27. endif ()
  28. add_library(minhook STATIC IMPORTED)
  29. set_target_properties(minhook PROPERTIES IMPORTED_LOCATION "${MINHOOK_LIB_LOC}")
  30. add_library(${CMAKE_PROJECT_NAME} SHARED
  31. src/main.cpp
  32. )
  33. set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "")
  34. target_link_libraries(${CMAKE_PROJECT_NAME}
  35. minhook
  36. psapi
  37. )
  38. set(EXECUTABLE_OUTPUT_PATH ${dir}release)
  39. set(LIBRARY_OUTPUT_PATH ${dir}release)