Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMAKE inherit definition from parent

Tags:

cmake

I am writing some definition in parent CMakeLists.txt I want those definition got inherited in sub directory of the project. So If I have project like

root
  |- CMakeLists.txt
  |- A 
  |  |- CMakeLists.txt
  |- B 
     |- CMakeLists.txt

the definition I had written in root CMakeLists.txt should go to child.

How to do that ?

like image 601
Vivek Goel Avatar asked Nov 02 '11 12:11

Vivek Goel


1 Answers

Change the order of include made those changes. In past I was using

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
SET(ENV{OSDEP} "linux")
SET(ENV{BIT} 64)
SET(ENV{XUL} 5000)
ADD_SUBDIRECTORY(lib/src/json)
add_definitions("-_DDEBUG")

which I changed last two line to

add_definitions("-_DDEBUG")
ADD_SUBDIRECTORY(lib/src/json)
like image 140
Vivek Goel Avatar answered Oct 24 '22 01:10

Vivek Goel