CheckWineGcc.cmake 942 B

12345678910111213141516171819202122232425262728
  1. INCLUDE(CheckCXXSourceCompiles)
  2. FUNCTION(CheckWineGcc BITNESS WINEGCC_EXECUTABLE RESULT)
  3. FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/winegcc_test.cxx" "
  4. #include <iostream>
  5. #define USE_WS_PREFIX
  6. #include <windows.h>
  7. int main(int argc, const char* argv[]) {
  8. return 0;
  9. }
  10. ")
  11. EXECUTE_PROCESS(COMMAND ${WINEGCC_EXECUTABLE} "-m${BITNESS}"
  12. "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/winegcc_test.cxx"
  13. "-o" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/winegcc_test"
  14. OUTPUT_QUIET ERROR_QUIET
  15. RESULT_VARIABLE WINEGCC_RESULT
  16. )
  17. FILE(REMOVE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/winegcc_test.cxx"
  18. "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/winegcc_test"
  19. "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/winegcc_test.exe.so"
  20. )
  21. IF(WINEGCC_RESULT EQUAL 0)
  22. SET(${RESULT} True PARENT_SCOPE)
  23. ELSE()
  24. SET(${RESULT} False PARENT_SCOPE)
  25. ENDIF()
  26. ENDFUNCTION()