myxx/MyxxCMake/lib/SyntaxCheck.cmake

19 lines
808 B
CMake
Raw Normal View History

2022-10-23 16:40:51 +00:00
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()