mirror of https://github.com/x64dbg/zydis
Minor CMake and C++ compatibility fixes
This commit is contained in:
parent
cbc9460547
commit
2e11b44ddf
|
@ -24,7 +24,8 @@ option(BUILD_TOOLS "Build tools" TRUE)
|
||||||
|
|
||||||
if (NOT CONFIGURED_ONCE)
|
if (NOT CONFIGURED_ONCE)
|
||||||
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
|
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
|
||||||
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
|
||||||
|
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
||||||
set(compiler_specific "-std=c99 -pedantic -Wextra -Werror")
|
set(compiler_specific "-std=c99 -pedantic -Wextra -Werror")
|
||||||
elseif (MSVC)
|
elseif (MSVC)
|
||||||
set(compiler_specific "/WX /W4 /D_CRT_SECURE_NO_WARNINGS /TC")
|
set(compiler_specific "/WX /W4 /D_CRT_SECURE_NO_WARNINGS /TC")
|
||||||
|
@ -34,7 +35,7 @@ if (NOT CONFIGURED_ONCE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# CMake always orders MSVC to build with a shared CRT. Hack CMake variables in order
|
# CMake always orders MSVC to build with a shared CRT. Hack CMake variables in order
|
||||||
# to generate with a statically linked CRT when we build as a static library.
|
# to generate with a statically linked CRT when we build a static library.
|
||||||
if (("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") AND NOT FORCE_SHARED_CRT)
|
if (("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") AND NOT FORCE_SHARED_CRT)
|
||||||
foreach(flag_var
|
foreach(flag_var
|
||||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||||
|
@ -74,12 +75,9 @@ if (BUILD_SHARED_LIBS AND WIN32)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_library("Zydis" ${headers} ${sources})
|
add_library("Zydis" ${headers} ${sources})
|
||||||
|
target_include_directories("Zydis" PUBLIC "include/" ${PROJECT_BINARY_DIR})
|
||||||
set_target_properties("Zydis" PROPERTIES COMPILE_DEFINITIONS "ZYDIS_EXPORTS")
|
set_target_properties("Zydis" PROPERTIES COMPILE_DEFINITIONS "ZYDIS_EXPORTS")
|
||||||
generate_export_header(
|
generate_export_header("Zydis" BASE_NAME "ZYDIS" EXPORT_FILE_NAME "ZydisExportConfig.h")
|
||||||
"Zydis"
|
|
||||||
BASE_NAME "ZYDIS"
|
|
||||||
EXPORT_FILE_NAME "ZydisExportConfig.h")
|
|
||||||
include_directories(${PROJECT_BINARY_DIR})
|
|
||||||
|
|
||||||
if (FEATURE_IMPLICITLY_USED_REGISTERS)
|
if (FEATURE_IMPLICITLY_USED_REGISTERS)
|
||||||
target_compile_definitions(Zydis PRIVATE ZYDIS_ENABLE_FEATURE_IMPLICITLY_USED_REGISTERS)
|
target_compile_definitions(Zydis PRIVATE ZYDIS_ENABLE_FEATURE_IMPLICITLY_USED_REGISTERS)
|
||||||
|
@ -93,8 +91,6 @@ endif ()
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
if (BUILD_EXAMPLES)
|
if (BUILD_EXAMPLES)
|
||||||
include_directories("include")
|
|
||||||
|
|
||||||
add_executable("FormatterHooks"
|
add_executable("FormatterHooks"
|
||||||
"examples/FormatterHooks.c"
|
"examples/FormatterHooks.c"
|
||||||
"examples/FormatHelper.h")
|
"examples/FormatHelper.h")
|
||||||
|
@ -104,8 +100,6 @@ endif ()
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
if (BUILD_TOOLS)
|
if (BUILD_TOOLS)
|
||||||
include_directories("include")
|
|
||||||
|
|
||||||
add_executable("ZydisDisasm" "tools/ZydisDisasm.c")
|
add_executable("ZydisDisasm" "tools/ZydisDisasm.c")
|
||||||
target_link_libraries("ZydisDisasm" "Zydis")
|
target_link_libraries("ZydisDisasm" "Zydis")
|
||||||
set_target_properties ("ZydisDisasm" PROPERTIES FOLDER "Tools")
|
set_target_properties ("ZydisDisasm" PROPERTIES FOLDER "Tools")
|
||||||
|
|
|
@ -46,6 +46,10 @@
|
||||||
*/
|
*/
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
/* Boolean */
|
/* Boolean */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
@ -64,4 +68,4 @@ typedef uint8_t ZydisBool;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ZYDIS_TYPES_H */
|
#endif /* ZYDIS_TYPES_H */
|
||||||
|
|
Loading…
Reference in New Issue