myxx/MyxxCMake/lib/SyntaxCheck.cmake
2022-10-23 19:40:51 +03:00

19 lines
808 B
CMake

include_guard(GLOBAL)
option(MYXX_CMAKE_SYNTAX_CHECK_ONLY "only check syntax (-fsyntax-only)" OFF)
if(MYXX_CMAKE_SYNTAX_CHECK_ONLY)
if (NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
myx_message_warning("only clang and gcc support -fsyntax-only, using ${CMAKE_CXX_COMPILER_ID}")
else()
add_compile_options(-fsyntax-only)
set(CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT} && touch <OBJECT>")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY "touch <TARGET>")
set(CMAKE_CXX_CREATE_SHARED_MODULE "touch <TARGET>")
set(CMAKE_CXX_LINK_EXECUTABLE "touch <TARGET>")
set(CMAKE_CXX_ARCHIVE_CREATE "touch <TARGET>")
set(CMAKE_CXX_ARCHIVE_APPEND "touch <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "touch <TARGET>")
endif()
endif()