How to create a makefile for Keystone library using cmake?

31 views Asked by At

I am trying to make a library using keystone and I was getting a lot of errors while using Cmake which was not happening when I use make. The CMakeLists.txt that I used was

cmake_minimum_required(VERSION 2.8)
project(sample)
set(CMAKE_C_FLAGS "-lstdc++ -lm")
include_directories("../../include")
add_executable(sample sample.c)
target_link_libraries(sample keystone)

The Makefile that worked perfectly was

.PHONY: all clean
KEYSTONE_LDFLAGS = -lkeystone -lstdc++ -lm
all:
    gcc -o sample sample.c ${KEYSTONE_LDFLAGS}
clean:
    rm -rf *.o sample

The sample.c file that I used is here

The error that I get is here.

What changes should I make so that the Cmake works fine.

0

There are 0 answers