Browse Source

A single approach was used to suppress the msvc C4996 compiler warning [_CRT_SECURE_NO_WARNINGS] (#2208)

tags/20201208
Evgeny Proydakov GitHub 5 years ago
parent
commit
8b0c46c45d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions
  1. +6
    -0
      benchmark/CMakeLists.txt
  2. +0
    -4
      benchmark/benchncnn.cpp
  3. +5
    -0
      tests/CMakeLists.txt

+ 6
- 0
benchmark/CMakeLists.txt View File

@@ -1,3 +1,9 @@

if(MSVC)
# warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
add_definitions(/wd4996)
endif()

add_executable(benchncnn benchncnn.cpp)
target_link_libraries(benchncnn PRIVATE ncnn)



+ 0
- 4
benchmark/benchncnn.cpp View File

@@ -12,10 +12,6 @@
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.

#ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <float.h>
#include <stdio.h>
#include <string.h>


+ 5
- 0
tests/CMakeLists.txt View File

@@ -1,4 +1,9 @@

if(MSVC)
# warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
add_definitions(/wd4996)
endif()

macro(ncnn_add_test name)
add_executable(test_${name} test_${name}.cpp)
target_link_libraries(test_${name} PRIVATE ncnn)


Loading…
Cancel
Save