Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding > Coding Tutorials
You last visited: Today at 02:30

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



How to "build" sources via CMake

Discussion on How to "build" sources via CMake within the Coding Tutorials forum part of the General Coding category.

Reply
 
Old   #1
 
elite*gold: 225
Join Date: Sep 2014
Posts: 334
Received Thanks: 461
How to "build" sources via CMake

Introduction
CMake is a handy and quick tool to generate makefiles which can then be used to build a project.
It can work in conjunction with many popular compilers including MSVC, GCC, clang. (C/C++ compilers)
Furthermore, it can be also used to produce makefiles for Java and Fortran.

In this tutorial you will learn how to build - a really nice extension for customizing IDA's GUI.
For more information/details visit the .


Acquisition
First off, you will ofc need . You can either use the CLI or the GUI.
I prefer to use the GUI because it's easier to set missing/invalid cache variables.
The plugin is using Qt stylesheets, hence you will need to link the Qt libraries.
For that install Qt 5.x if your plan is to build the plugin for IDA 6.9 and higher or Qt 4.x for IDA 6.8 and below.
However I recommend to install both if you are going to work alot with Qt.

After downloading and installing CMake and Qt we will need the actual source code to build from.
Go ahead and clone the project or download it as zip-file if you haven't got GitHub Desktop.
You will note a CMakeLists.txt - that's the main script file, used to let CMake know what to do.


Preparing the environment
Open the cmake folder and head to the IDA.cmake file.
Edit line 29/30 to point to the SDK and to the IDA installation directory, respectively.
Alternatively, you can also set two environment variables "IDASDK" and "IDADIR".

This being done the only thing we still need to do is to let CMake know where our Qt dependencies are.
There are a few possibilities to do that:
  • Set the cached CMAKE_PREFIX_PATH variable to e.g. C:\Qt\5.7\msvc2015_64
  • Set the environment variable CMAKE_PREFIX_PATH to e.g. C:\Qt\5.7\msvc2015_64
  • Set the cached Qt5<Module>_DIR variable to the location of the Qt5<Module>Config.cmake file

Building the project file
Fire up cmake-gui and set the source path to the path where the CMakeLists.txt is contained in.
For the build path I will create a new directory in the source path called 'bin' and assign that path to the build path.

If you decided to set the cached variables you can do now in the entry view(Assuming you have already loaded the CMakeFiles.txt file)
or you have to go back and set them in the CMakeLists.txt file before you make any call to 'find_package'.
Cyrex' is offline  
Thanks
2 Users
Old 08/03/2016, 15:50   #2


 
Ende!'s Avatar
 
elite*gold: 1
Join Date: Feb 2009
Posts: 6,379
Received Thanks: 7,998
Nice. It's worth noting that you can also pass IDASDK and IDADIR variables directly to CMake via the "-D" switch, e.g. "-DIDADIR=C:\meow" or add them in the CMake GUI -- no script hacking required!
Ende! is offline  
Thanks
1 User
Old 08/30/2016, 05:15   #3
 
ValenFX's Avatar
 
elite*gold: 0
Join Date: Aug 2016
Posts: 22
Received Thanks: 41
Great tutorial! Thanks for sharing.
ValenFX is offline  
Reply




All times are GMT +2. The time now is 02:30.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.