Browse Source

cmake: better tgmath.h check.

hl_urbicide
Andrey Akhmichin 3 years ago
parent
commit
d8b05d12d5
No known key found for this signature in database
GPG Key ID: 1F180D249B0643C0
  1. 11
      CMakeLists.txt
  2. 6
      cl_dll/CMakeLists.txt
  3. 6
      dlls/CMakeLists.txt

11
CMakeLists.txt

@ -29,6 +29,8 @@ endif() @@ -29,6 +29,8 @@ endif()
# Install custom module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
include(CheckIncludeFile)
include(CheckCSourceCompiles)
include(VSForceXPToolchain) # Force XP toolchain for Visual Studio
project (HLSDK-XASH3D)
@ -111,6 +113,15 @@ else() @@ -111,6 +113,15 @@ else()
add_definitions(-D_CRT_SILENCE_NONCONFORMING_TGMATH_H)
endif()
check_include_file("tgmath.h" HAVE_TGMATH_H)
if(HAVE_TGMATH_H)
check_c_source_compiles("#include <tgmath.h>
const float val = 2, val2 = 3;
int main(){ return (int)(-asin(val) + cos(val2));" HAVE_VALID_TGMATH_H )
if(${HAVE_VALID_TGMATH_H})
add_definitions(-DHAVE_TGMATH_H)
endif()
endif()
if(BUILD_CLIENT)
add_subdirectory(cl_dll)

6
cl_dll/CMakeLists.txt

@ -25,12 +25,6 @@ project (CLDLL) @@ -25,12 +25,6 @@ project (CLDLL)
set (CLDLL_LIBRARY client)
include(CheckIncludeFile)
check_include_file("tgmath.h" HAVE_TGMATH_H)
if(HAVE_TGMATH_H)
add_definitions(-DHAVE_TGMATH_H)
endif()
add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL)
if(NOT MSVC)

6
dlls/CMakeLists.txt

@ -25,12 +25,6 @@ project (SVDLL) @@ -25,12 +25,6 @@ project (SVDLL)
set (SVDLL_LIBRARY server)
include(CheckIncludeFile)
check_include_file("tgmath.h" HAVE_TGMATH_H)
if(HAVE_TGMATH_H)
add_definitions(-DHAVE_TGMATH_H)
endif()
add_definitions(-DCLIENT_WEAPONS)
if(NOT MSVC)

Loading…
Cancel
Save