Several corrections to the CMake project files (thanks, Ozkan!).
authorRyan C. Gordon <icculus@icculus.org>
Fri, 20 Mar 2015 21:57:15 -0400
changeset 9414669bf9fb901e
parent 9413 eb50f63a5777
child 9415 93547cc94383
Several corrections to the CMake project files (thanks, Ozkan!).

Fixes Bugzilla #2732.
CMakeLists.txt
cmake/sdlchecks.cmake
     1.1 --- a/CMakeLists.txt	Fri Mar 20 12:23:53 2015 -0400
     1.2 +++ b/CMakeLists.txt	Fri Mar 20 21:57:15 2015 -0400
     1.3 @@ -596,7 +596,7 @@
     1.4        set(CMAKE_REQUIRED_LIBRARIES m)
     1.5        foreach(_FN
     1.6                atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin
     1.7 -              sinf sqrt sqrtf tan tanf)
     1.8 +              sinf sqrt sqrtf tan tanf acos asin)
     1.9          string(TOUPPER ${_FN} _UPPER)
    1.10          set(_HAVEVAR "HAVE_${_UPPER}")
    1.11          check_function_exists("${_FN}" ${_HAVEVAR})
    1.12 @@ -608,6 +608,15 @@
    1.13      check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
    1.14      if(HAVE_LIBICONV)
    1.15        list(APPEND EXTRA_LIBS iconv)
    1.16 +      set(HAVE_ICONV 1)
    1.17 +    endif()
    1.18 +
    1.19 +    if(NOT APPLE)
    1.20 +      check_include_file(alloca.h HAVE_ALLOCA_H)
    1.21 +      check_function_exists(alloca HAVE_ALLOCA)
    1.22 +    else()
    1.23 +      set(HAVE_ALLOCA_H 1)
    1.24 +      set(HAVE_ALLOCA 1)
    1.25      endif()
    1.26  
    1.27      check_struct_has_member("struct sigaction" "sa_sigaction" "signal.h" HAVE_SA_SIGACTION)
     2.1 --- a/cmake/sdlchecks.cmake	Fri Mar 20 12:23:53 2015 -0400
     2.2 +++ b/cmake/sdlchecks.cmake	Fri Mar 20 21:57:15 2015 -0400
     2.3 @@ -725,7 +725,7 @@
     2.4    endif()
     2.5  endmacro()
     2.6  
     2.7 -# Rquires:
     2.8 +# Requires:
     2.9  # - nada
    2.10  # Optional:
    2.11  # - THREADS opt
    2.12 @@ -776,13 +776,17 @@
    2.13  
    2.14      # Run some tests
    2.15      set(CMAKE_REQUIRED_FLAGS "${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}")
    2.16 -    check_c_source_runs("
    2.17 +    if(CMAKE_CROSSCOMPILING)
    2.18 +      set(HAVE_PTHREADS 1)
    2.19 +    else()
    2.20 +      check_c_source_runs("
    2.21          #include <pthread.h>
    2.22          int main(int argc, char** argv) {
    2.23            pthread_attr_t type;
    2.24            pthread_attr_init(&type);
    2.25            return 0;
    2.26          }" HAVE_PTHREADS)
    2.27 +    endif()
    2.28      if(HAVE_PTHREADS)
    2.29        set(SDL_THREAD_PTHREAD 1)
    2.30        list(APPEND EXTRA_CFLAGS ${PTHREAD_CFLAGS})
    2.31 @@ -831,9 +835,8 @@
    2.32            #include <pthread.h>
    2.33            #include <pthread_np.h>
    2.34            int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
    2.35 -      check_function_exists(pthread_setname_np HAVE_PTHREAD_setNAME_NP)
    2.36 -      check_function_exists(pthread_set_name_np HAVE_PTHREAD_set_NAME_NP)
    2.37 -      set(CMAKE_REQUIRED_FLAGS)
    2.38 +      check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
    2.39 +      check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)      set(CMAKE_REQUIRED_FLAGS)
    2.40  
    2.41        set(SOURCE_FILES ${SOURCE_FILES}
    2.42            ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c