mirror of
https://github.com/loot/loot-condition-interpreter.git
synced 2026-07-27 14:16:09 -07:00
Fix building C++ wrapper with CMake 4.0+
Also update CMakeLists.txt to use target-specific commands and PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR.
This commit is contained in:
+12
-12
@@ -1,22 +1,22 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8...4.3)
|
||||||
project(ffi_tests CXX)
|
project(ffi_tests CXX)
|
||||||
|
|
||||||
include_directories("${CMAKE_SOURCE_DIR}/include")
|
add_executable(ffi_cpp_tests "${PROJECT_SOURCE_DIR}/tests/ffi.cpp")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set_target_properties(ffi_cpp_tests PROPERTIES CXX_STANDARD 11)
|
||||||
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
target_include_directories(ffi_cpp_tests PRIVATE "${PROJECT_SOURCE_DIR}/include")
|
||||||
set (SYSTEM_LIBS pthread dl)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (MSVC)
|
target_link_libraries(ffi_cpp_tests PRIVATE
|
||||||
set (SYSTEM_LIBS ntdll ws2_32 Userenv bcrypt)
|
"${PROJECT_SOURCE_DIR}/../target/debug/${CMAKE_STATIC_LIBRARY_PREFIX}loot_condition_interpreter_ffi${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||||
endif ()
|
|
||||||
|
|
||||||
set (FFI_LIBRARY "${CMAKE_SOURCE_DIR}/../target/debug/${CMAKE_STATIC_LIBRARY_PREFIX}loot_condition_interpreter_ffi${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
target_link_libraries(ffi_cpp_tests PRIVATE pthread dl)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(ffi_cpp_tests "${CMAKE_SOURCE_DIR}/tests/ffi.cpp")
|
if(MSVC)
|
||||||
target_link_libraries(ffi_cpp_tests ${FFI_LIBRARY} ${SYSTEM_LIBS})
|
target_link_libraries(ffi_cpp_tests PRIVATE ntdll ws2_32 Userenv bcrypt)
|
||||||
|
endif()
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_test(ffi_cpp_tests ffi_cpp_tests)
|
add_test(ffi_cpp_tests ffi_cpp_tests)
|
||||||
|
|||||||
Reference in New Issue
Block a user