Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
be429079
Commit
be429079
authored
Nov 05, 2015
by
Baruch Sterin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMakeLists.txt: pass CXX flags from the Makefile
parent
c0ba25a6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
CMakeLists.txt
+13
-5
Makefile
+1
-0
No files found.
CMakeLists.txt
View file @
be429079
cmake_minimum_required
(
VERSION
2.8.12
)
cmake_minimum_required
(
VERSION
3.3.0
)
include
(
CMakeParseArguments
)
include
(
CheckCCompilerFlag
)
include
(
CheckCXXCompilerFlag
)
# filter out flags that are not appropriate for the compiler used
# filter out flags that are not appropriate for the compiler
being
used
function
(
target_compile_options_filtered target visibility
)
foreach
(
flag
${
ARGN
}
)
if
(
flag MATCHES
"^-D.*"
)
target_compile_options
(
${
target
}
${
visibility
}
${
flag
}
)
else
()
check_c_compiler_flag
(
${
flag
}
COMPILER_SUPPORTS__
${
flag
}
)
if
(
COMPILER_SUPPORTS__
${
flag
}
)
target_compile_options
(
${
target
}
${
visibility
}
${
flag
}
)
check_c_compiler_flag
(
${
flag
}
C_COMPILER_SUPPORTS__
${
flag
}
)
if
(
C_COMPILER_SUPPORTS__
${
flag
}
)
target_compile_options
(
${
target
}
${
visibility
}
$<$<COMPILE_LANGUAGE:C>:
${
flag
}
>
)
endif
()
check_cxx_compiler_flag
(
${
flag
}
CXX_COMPILER_SUPPORTS__
${
flag
}
)
if
(
CXX_COMPILER_SUPPORTS__
${
flag
}
)
target_compile_options
(
${
target
}
${
visibility
}
$<$<COMPILE_LANGUAGE:CXX>:
${
flag
}
>
)
endif
()
endif
()
endforeach
()
...
...
@@ -40,6 +46,8 @@ endfunction()
extract_var
(
SEPARATOR_SRC ABC_SRC
${
MAKE_OUTPUT
}
)
extract_var
(
SEPARATOR_LIBS ABC_LIBS
${
MAKE_OUTPUT
}
)
extract_var
(
SEPARATOR_CFLAGS ABC_CFLAGS
${
MAKE_OUTPUT
}
)
extract_var
(
SEPARATOR_CXXFLAGS ABC_CXXFLAGS
${
MAKE_OUTPUT
}
)
add_executable
(
abc
${
ABC_SRC
}
)
...
...
Makefile
View file @
be429079
...
...
@@ -193,5 +193,6 @@ docs:
cmake_info
:
@
echo
SEPARATOR_CFLAGS
$(CFLAGS)
SEPARATOR_CFLAGS
@
echo
SEPARATOR_CXXFLAGS
$(CXXFLAGS)
SEPARATOR_CXXFLAGS
@
echo
SEPARATOR_LIBS
$(LIBS)
SEPARATOR_LIBS
@
echo
SEPARATOR_SRC
$(SRC)
SEPARATOR_SRC
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment