mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-28 00:15:06 +00:00
Simplify the bullet detection. This way we don't need to explicitly pass
all possible variables to the try_compile stuff
This commit is contained in:
parent
0f33734f5d
commit
231780a51d
@ -14,37 +14,13 @@ int main(int argc, char** argv)
|
||||
}
|
||||
")
|
||||
|
||||
file(WRITE ${TMP_ROOT}/CMakeLists.txt
|
||||
"
|
||||
cmake_minimum_required(VERSION 3.1.0)
|
||||
project(checkbullet)
|
||||
|
||||
# First, try BulletConfig-float64.cmake which comes with Debian derivatives.
|
||||
find_package(Bullet CONFIGS BulletConfig-float64.cmake QUIET COMPONENTS BulletCollision LinearMath)
|
||||
if (BULLET_FOUND)
|
||||
# Fix the relative include:
|
||||
set(BULLET_INCLUDE_DIRS \"\$\{BULLET_ROOT_DIR\}/\$\{BULLET_INCLUDE_DIRS\}\")
|
||||
else()
|
||||
find_package(Bullet REQUIRED COMPONENTS BulletCollision LinearMath)
|
||||
endif()
|
||||
string(REGEX MATCHALL \"((optimized|debug);)?[^;]*(BulletCollision|LinearMath)[^;]*\" BULLET_LIBRARIES \"$\{BULLET_LIBRARIES\}\")
|
||||
|
||||
add_executable(checkbullet checkbullet.cpp)
|
||||
target_compile_definitions(checkbullet PUBLIC BT_USE_DOUBLE_PRECISION)
|
||||
target_include_directories(checkbullet PUBLIC \$\{BULLET_INCLUDE_DIRS\})
|
||||
target_link_libraries(checkbullet \$\{BULLET_LIBRARIES\})
|
||||
")
|
||||
|
||||
if (DEFINED BULLET_ROOT)
|
||||
set(ROOT "-DBULLET_ROOT=${BULLET_ROOT}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Checking if Bullet uses double precision")
|
||||
|
||||
try_compile(RESULT_VAR
|
||||
${CMAKE_BINARY_DIR}/temp
|
||||
${TMP_ROOT}
|
||||
checkbullet
|
||||
CMAKE_FLAGS "${ROOT}"
|
||||
${TMP_ROOT}/temp
|
||||
${TMP_ROOT}/checkbullet.cpp
|
||||
COMPILE_DEFINITIONS "-DBT_USE_DOUBLE_PRECISION"
|
||||
LINK_LIBRARIES ${BULLET_LIBRARIES}
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${BULLET_INCLUDE_DIRS}"
|
||||
)
|
||||
set(HAS_DOUBLE_PRECISION_BULLET ${RESULT_VAR})
|
||||
|
Loading…
Reference in New Issue
Block a user