mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
CMake : Detect and set COMPILER_IS_GCC.
This commit is contained in:
parent
8971af22d0
commit
bfd1320d9c
11
CMake/compiler_is_gcc.c
Normal file
11
CMake/compiler_is_gcc.c
Normal file
@ -0,0 +1,11 @@
|
||||
int main (void)
|
||||
{
|
||||
#if __GNUC__
|
||||
#if __clang__
|
||||
This is clang
|
||||
# endif
|
||||
#else
|
||||
This is not GCC.
|
||||
#endif
|
||||
return 0 ;
|
||||
}
|
20
CMake/libsndfile.cmake
Normal file
20
CMake/libsndfile.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
include (TestBigEndian)
|
||||
|
||||
function (try_compile_c_result C_FILE RESULT_NAME RESULT_PASS RESULT_FAIL)
|
||||
try_compile (COMPILE_RESULT
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/compiler_is_gcc.c
|
||||
# OUTPUT_VARIABLE LOG2
|
||||
)
|
||||
|
||||
if (${COMPILE_RESULT})
|
||||
set (${RESULT_NAME} ${RESULT_PASS} PARENT_SCOPE)
|
||||
else (${VARNAME})
|
||||
set (${RESULT_NAME} ${RESULT_FAIL} PARENT_SCOPE)
|
||||
endif (${COMPILE_RESULT})
|
||||
|
||||
endfunction ()
|
||||
|
||||
|
||||
try_compile_c_result (CMake/compiler_is_gcc.c COMPILER_IS_GCC 1 0)
|
@ -1,6 +1,12 @@
|
||||
# cmakelists.txt for libsndfile
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
set (BASEPATH "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
project (libsndfile C)
|
||||
|
||||
include (CMake/libsndfile.cmake)
|
||||
|
||||
if (MSVC)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4996")
|
||||
add_definitions ("/wd4244 /wd4996")
|
||||
@ -18,7 +24,7 @@ else (MSVC)
|
||||
set (HAVE_INTTYPES_H 1)
|
||||
set (HAVE_STDINT_H 1)
|
||||
set (SIZEOF_LONG 4)
|
||||
set (COMPILER_IS_GCC 1)
|
||||
set (COMPILER_IS_GCC ${COMPILER_IS_GCC})
|
||||
set (OS_IS_WIN32 0)
|
||||
set (USE_WINDOWS_API 0)
|
||||
set (SIZEOF_INT64_T 8)
|
||||
@ -42,7 +48,6 @@ else (MSVC)
|
||||
set (OSX_DARWIN_VERSION 0)
|
||||
endif (MSVC)
|
||||
|
||||
include (TestBigEndian)
|
||||
TEST_BIG_ENDIAN (BIGENDIAN)
|
||||
if (${BIGENDIAN})
|
||||
set (WORDS_BIGENDIAN 1)
|
||||
@ -56,7 +61,6 @@ endif (${BIGENDIAN})
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Project definitions follow.
|
||||
project (libsndfile C)
|
||||
|
||||
configure_file (src/sndfile.h.in src/sndfile.h)
|
||||
configure_file (CMake/config.h.in src/config.h)
|
||||
|
Loading…
Reference in New Issue
Block a user