-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeFlagsParser.py
More file actions
32 lines (26 loc) · 922 Bytes
/
CMakeFlagsParser.py
File metadata and controls
32 lines (26 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
def sanityCheck(string):
if '=' not in string:
raise Exception('''Invalid command line option''' + string +
'''passed''')
def splitString(string):
pos = string.find('=')
return string[:pos], string[pos+1:]
def getConfig():
DFTEFE_PATH = os.environ['DFTEFE_PATH']
f = open(DFTEFE_PATH+'/CMakeConfigOptions.txt', 'r')
lines = f.readlines()
if len(lines) == 0:
raise Exception('''Empty CMakeConfigOptions.txt found. Please run
./configure.py with the correct options''' )
cmake_config_opts = []
cmake_dict = {}
for line in lines:
sanityCheck(line)
key,value = splitString(line)
cmake_dict[key]=value
for key in cmake_dict:
value = cmake_dict[key]
opts='-D' + key + '=' + value.strip()
cmake_config_opts.append(opts)
return cmake_config_opts