Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
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
Chen Yisong
benchmark
Commits
90293603
Commit
90293603
authored
Aug 15, 2017
by
Victor Costan
Committed by
Dominic Hamon
Aug 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMake: Fallback from try_run to try_compile when cross-compiling. (#436)
parent
3347a20e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
CXXFeatureCheck.cmake
cmake/CXXFeatureCheck.cmake
+21
-5
No files found.
cmake/CXXFeatureCheck.cmake
View file @
90293603
...
...
@@ -26,11 +26,28 @@ function(cxx_feature_check FILE)
add_definitions
(
-DHAVE_
${
VAR
}
)
return
()
endif
()
message
(
"-- Performing Test
${
FEATURE
}
"
)
try_run
(
RUN_
${
FEATURE
}
COMPILE_
${
FEATURE
}
${
CMAKE_BINARY_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/
${
FILE
}
.cpp
CMAKE_FLAGS
${
BENCHMARK_CXX_LINKER_FLAGS
}
LINK_LIBRARIES
${
BENCHMARK_CXX_LIBRARIES
}
)
if
(
CMAKE_CROSSCOMPILING
)
try_compile
(
COMPILE_
${
FEATURE
}
${
CMAKE_BINARY_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/
${
FILE
}
.cpp
CMAKE_FLAGS
${
BENCHMARK_CXX_LINKER_FLAGS
}
LINK_LIBRARIES
${
BENCHMARK_CXX_LIBRARIES
}
)
if
(
COMPILE_
${
FEATURE
}
)
message
(
WARNING
"If you see build failures due to cross compilation, try setting HAVE_
${
VAR
}
to 0"
)
set
(
RUN_
${
FEATURE
}
0
)
else
()
set
(
RUN_
${
FEATURE
}
1
)
endif
()
else
()
message
(
"-- Performing Test
${
FEATURE
}
"
)
try_run
(
RUN_
${
FEATURE
}
COMPILE_
${
FEATURE
}
${
CMAKE_BINARY_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/
${
FILE
}
.cpp
CMAKE_FLAGS
${
BENCHMARK_CXX_LINKER_FLAGS
}
LINK_LIBRARIES
${
BENCHMARK_CXX_LIBRARIES
}
)
endif
()
if
(
RUN_
${
FEATURE
}
EQUAL 0
)
message
(
"-- Performing Test
${
FEATURE
}
-- success"
)
set
(
HAVE_
${
VAR
}
1 CACHE INTERNAL
"Feature test for
${
FILE
}
"
PARENT_SCOPE
)
...
...
@@ -43,4 +60,3 @@ function(cxx_feature_check FILE)
endif
()
endif
()
endfunction
()
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