CMake Error: Incorrect IF/ENDIF Arguments in CMakeLists.txt
The error message indicates issues within the CMakeLists.txt file, specifically on lines 114, 116, 117, and 119. These lines contain if and endif statements with incorrect arguments. The problem arises from how the GCC_VERSION is being compared within the conditional statements.
To resolve this, you need to modify the CMakeLists.txt file. Here's how to fix the specific issues:
-
Line 114: Replace the
ifstatement's argument fromGCC_VERSION VERSION_GREATER 4.5 OR GCC_VERSION VERSION_EQUAL 4.5withGCC_VERSION VERSION_GREATER_EQUAL 4.5. This ensures the code block is executed if the GCC version is 4.5 or greater. -
Line 116: Change the
endifstatement toendif(). This correctly closes theifblock started on line 114. -
Line 117: Modify the
ifstatement's argument fromGCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8toGCC_VERSION VERSION_GREATER_EQUAL 4.8. This ensures the code block executes if the GCC version is 4.8 or greater. -
Line 119: Change the
endifstatement toendif(). This correctly closes theifblock started on line 117.
Corrected Example:
if(GCC_VERSION VERSION_GREATER_EQUAL 4.5)
# your code here
endif()
# your code here
if(GCC_VERSION VERSION_GREATER_EQUAL 4.8)
# your code here
endif()
After making these changes, rerun the CMake tool. The errors related to incorrect if and endif arguments should be resolved, and the configuration process should proceed successfully.
原文地址: https://www.cveoy.top/t/topic/m02A 著作权归作者所有。请勿转载和采集!