Skip to content

Commit

Permalink
Merge pull request #22 from AbigailBuccaneer/fix/21
Browse files Browse the repository at this point in the history
 Fix compiling with '-DFOO='
  • Loading branch information
AbigailBuccaneer authored Mar 12, 2018
2 parents 70cc383 + 4c7fd02 commit 18707e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions json2cmake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def parsecommand(command, resolvepath):
next(words) # remove the initial 'cc' / 'c++'

options = []
defines = {}
defines = []
includes = []
system_includes = set()

Expand All @@ -50,10 +50,7 @@ def parsecommand(command, resolvepath):
includes.append(include)
system_includes.add(include)
elif word.startswith('-D'):
key, _, value = word[2:].partition('=')
if value == '':
value = True
defines[key] = value
defines.append(word[2:])
elif word == '-c':
continue
elif word.startswith('-'):
Expand Down Expand Up @@ -112,11 +109,8 @@ def write(self, output, directory=None, name='autogenerated'):
output.write(')\n')

output.write('target_compile_definitions(%s PRIVATE\n' % name)
for (define, value) in config['defines']:
str = define
if value is not True:
str = str + '=' + value
output.write(' %s\n' % str)
for define in config['defines']:
output.write(' %s\n' % define)
output.write(')\n')

output.write('target_include_directories(%s PRIVATE\n' % name)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='json2cmake',
version='0.6.0',
version='0.6.1',
description='Generate CMakeLists.txt from a compile_commands.json',
long_description=long_description,
url='https://github.com/AbigailBuccaneer/json2cmake',
Expand Down

0 comments on commit 18707e3

Please sign in to comment.