From eb526fc4f55cd5bdf173aa4766ad63f776202db9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 20 Feb 2018 13:10:38 +0000 Subject: [PATCH 1/5] Replacements and suppress warnings in the test code --- .../test/Box_intersection_d/util.h | 9 +++++++++ .../test/Minkowski_sum_2/test_exact_offset.cpp | 10 ++++++++++ Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 10 +++++----- .../include/CGAL/Polynomial/Polynomial_type.h | 17 ++++++++--------- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Box_intersection_d/test/Box_intersection_d/util.h b/Box_intersection_d/test/Box_intersection_d/util.h index 7daacea3951..9b6c3acd466 100644 --- a/Box_intersection_d/test/Box_intersection_d/util.h +++ b/Box_intersection_d/test/Box_intersection_d/util.h @@ -1,6 +1,15 @@ #ifndef CGAL_BOX_INTERSECTION_D_UTIL_H #define CGAL_BOX_INTERSECTION_D_UTIL_H + +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + #include #include // for pair #include diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp b/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp index bdf9f0ddc82..93adbe6d228 100644 --- a/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp +++ b/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp @@ -23,6 +23,16 @@ int main () #include "read_polygon.h" #include + +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + + typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; diff --git a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index fe24747d993..f97586698b4 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -31,7 +31,7 @@ #include #include #include -#include // for std::strcpy +#include #ifdef CGAL_NEF3_TRIANGULATE_FACETS #include @@ -70,7 +70,7 @@ class SNC_point_locator typedef typename SNC_decorator::Decorator_traits Decorator_traits; typedef typename SNC_decorator::SNC_structure SNC_structure; protected: - char version_[64]; + std::string version_; // time for construction, point location, ray shooting and intersection test mutable Timer ct_t, pl_t, rs_t, it_t; @@ -93,7 +93,7 @@ public: typedef typename Decorator_traits::Halffacet_iterator Halffacet_iterator; - const char* version() { return version_; } + const std::string& version() const { return version_; } virtual Object_handle locate(const Point_3& p) const = 0; @@ -308,7 +308,7 @@ public: candidate_provider = new SNC_candidate_provider(W); #else // CGAL_NEF_LIST_OF_TRIANGLES CGAL_NEF_TIMER(ct_t.start()); - std::strcpy( this->version_, "Point Locator by Spatial Subdivision (tm)"); + this->version_ = std::string("Point Locator by Spatial Subdivision (tm)"); #ifdef CGAL_NEF3_TRIANGULATE_FACETS CGAL_NEF_CLOG(version()<<" (with triangulated facets)"); #else @@ -1275,7 +1275,7 @@ public: SNC_point_locator_naive() : initialized(false) {} virtual void initialize(SNC_structure* W) { CGAL_NEF_TIMER(ct_t.start()); - std::strcpy(this->version_, "Naive Point Locator (tm)"); + this->version_ = std::string("Naive Point Locator (tm)"); CGAL_NEF_CLOG(version()); CGAL_assertion( W != NULL); Base::initialize(W); diff --git a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h index d42e576c009..a5bfd08c419 100644 --- a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h +++ b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h @@ -44,6 +44,7 @@ typename CGAL::internal::Innermost_coefficient_type::Type , 2>::Type #include #include #include +#include #include #include @@ -1305,7 +1306,7 @@ std::istream& operator >> (std::istream& is, Polynomial& p) { template inline void print_maple_monomial(std::ostream& os, const NT& coeff, - const char *var, int expn) + const std::string& var, int expn) { if (expn == 0 || coeff != NT(1)) { os << CGAL::oformat(coeff, Parens_as_product_tag()); @@ -1323,24 +1324,22 @@ template class Polynomial_traits_d; template void Polynomial::output_maple(std::ostream& os) const { const Polynomial& p = *this; - const char *varname; - char vnbuf[42]; - + std::ostringstream oss; + // use variable names x, y, z, w1, w2, w3, ... if (Polynomial_traits_d::d < 3) { static const char *varnames[] = { "x", "y", "z" }; - varname = varnames[Polynomial_traits_d::d]; + oss << varnames[Polynomial_traits_d::d]; } else { - std::sprintf(vnbuf, "w%d", Polynomial_traits_d::d - 2); - varname = vnbuf; + oss << "w" << Polynomial_traits_d::d - 2; } int i = p.degree(); - CGAL::print_maple_monomial(os, p[i], varname, i); + CGAL::print_maple_monomial(os, p[i], oss.str(), i); while (--i >= 0) { if (p[i] != NT(0)) { os << " + "; - CGAL::print_maple_monomial(os, p[i], varname, i); + CGAL::print_maple_monomial(os, p[i], oss.str(), i); } } } From 42c26be666962d79bbcb9010f0eba2700152dbee Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 22 Feb 2018 17:04:48 +0000 Subject: [PATCH 2/5] #define ... 1 --- Box_intersection_d/test/Box_intersection_d/util.h | 4 ++-- Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Box_intersection_d/test/Box_intersection_d/util.h b/Box_intersection_d/test/Box_intersection_d/util.h index 9b6c3acd466..23b8213bbea 100644 --- a/Box_intersection_d/test/Box_intersection_d/util.h +++ b/Box_intersection_d/test/Box_intersection_d/util.h @@ -3,11 +3,11 @@ #ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE 1 #endif #ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS 1 #endif #include diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp b/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp index 93adbe6d228..45843652f51 100644 --- a/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp +++ b/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp @@ -25,11 +25,11 @@ int main () #ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE 1 #endif #ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS 1 #endif From f7ba8ff4df93f3f5b002b58eea1c046f45981b04 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 23 Feb 2018 11:35:58 +0000 Subject: [PATCH 3/5] Fix Box_intersection_d, Minkowski_sum_2, Nef_3, Surface_mesh, Straight_skeleton, Triangulation_3 --- .../Box_intersection_d/automated_test.cpp | 8 ++ .../test/Box_intersection_d/util.h | 8 -- .../Minkowski_sum_2/test_exact_offset.cpp | 16 ++-- Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h | 15 ++-- .../include/CGAL/IO/Dxf_writer.h | 20 +++-- Surface_mesh/include/CGAL/Surface_mesh/IO.h | 86 ++++++++----------- .../Triangulation_3/test_regular_remove_3.cpp | 8 +- 7 files changed, 68 insertions(+), 93 deletions(-) diff --git a/Box_intersection_d/test/Box_intersection_d/automated_test.cpp b/Box_intersection_d/test/Box_intersection_d/automated_test.cpp index 52d06a1f141..48a2c37f2c3 100644 --- a/Box_intersection_d/test/Box_intersection_d/automated_test.cpp +++ b/Box_intersection_d/test/Box_intersection_d/automated_test.cpp @@ -23,6 +23,14 @@ // enable invariant checking #define CGAL_SEGMENT_TREE_CHECK_INVARIANTS 1 +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS 1 +#endif + #include #include #include diff --git a/Box_intersection_d/test/Box_intersection_d/util.h b/Box_intersection_d/test/Box_intersection_d/util.h index 23b8213bbea..59bedccf6a7 100644 --- a/Box_intersection_d/test/Box_intersection_d/util.h +++ b/Box_intersection_d/test/Box_intersection_d/util.h @@ -2,14 +2,6 @@ #define CGAL_BOX_INTERSECTION_D_UTIL_H -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE 1 -#endif - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS 1 -#endif - #include #include // for pair #include diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp b/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp index 45843652f51..1fda8219ff4 100644 --- a/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp +++ b/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp @@ -3,6 +3,7 @@ #ifndef CGAL_USE_CORE #include +#include int main () { @@ -24,15 +25,6 @@ int main () #include -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE 1 -#endif - -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS 1 -#endif - - typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; @@ -91,8 +83,10 @@ int main (int argc, char **argv) // Read the offset radius. int numer, denom; - - if (sscanf (argv[i+1], "%d/%d", &numer, &denom) != 2) + char c; + std::istringstream iss(argv[i+1]); + iss >> numer >> c >> denom; + if (! iss.good()) { std::cerr << "Invalid radius: " << argv[i+1] << std::endl; return (1); diff --git a/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h b/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h index e4ff83ebba9..73db70ceb94 100644 --- a/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h +++ b/Nef_3/test/Nef_3/include/CGAL/test_Nef_3.h @@ -34,6 +34,7 @@ #include #include #include +#include namespace CGAL { @@ -143,13 +144,10 @@ private: } bool does_nef3_equals_file(Nef_polyhedron& N, const char* name) { - char* fullname = new char[std::strlen(datadir)+std::strlen(name)+1]; - std::strcpy(fullname, datadir); - std::strcat(fullname, name); + std::string fullname = std::string(datadir) + std::string(name); std::ofstream out("data/temp.nef3"); out << N; - bool b = are_files_equal("data/temp.nef3",fullname); - delete [] fullname; + bool b = are_files_equal("data/temp.nef3",fullname.c_str()); return b; } @@ -163,14 +161,11 @@ private: } Nef_polyhedron load_nef3(const char* name) { - char* fullname = new char[std::strlen(datadir)+std::strlen(name)+1]; - std::strcpy(fullname, datadir); - std::strcat(fullname, name); - std::ifstream input(fullname); + std::string fullname = std::string(datadir) + std::string(name); + std::ifstream input(fullname.c_str()); assert(input.good()); Nef_polyhedron tmp; input >> tmp; - delete[] fullname; return tmp; } diff --git a/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h b/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h index 3f5c5e365e5..d0313eeecf7 100644 --- a/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h +++ b/Straight_skeleton_2/include/CGAL/IO/Dxf_writer.h @@ -27,8 +27,10 @@ #include #include #include +#include #include #include +#include namespace CGAL { @@ -140,24 +142,24 @@ private: std::string get_entity_handle() { - char lBuff[64]; - sprintf(lBuff,"%5x",mHandle++); - return std::string(lBuff); + std::ostringstream oss; + oss << boost::format("%5x") % mHandle++; + return oss.str(); } std::string to_str ( int aN ) { - char lBuff[64]; - sprintf(lBuff,"%6d",aN); - return std::string(lBuff); + std::ostringstream oss; + oss << boost::format("%6d") % aN; + return oss.str(); } std::string to_str ( double aN ) { - char lBuff[64]; - sprintf(lBuff,"%6.6f",aN); - return std::string(lBuff); + std::ostringstream oss; + oss << boost::format("%6.6f") % aN; + return oss.str(); } void insert_line ( Line_iterator aPos, std::string aLine ) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO.h b/Surface_mesh/include/CGAL/Surface_mesh/IO.h index bcfc15dca9a..2f16c770120 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO.h @@ -29,7 +29,8 @@ //== INCLUDES ================================================================= #include -#include +#include +#include #include #include #include @@ -51,17 +52,14 @@ namespace CGAL { namespace internal { // helper function -template void read(FILE* in, T& t) + template void read(std::istream& in, T& t) { - std::size_t err = 0; - err = fread(&t, 1, sizeof(t), in); - if(err != 0) - throw std::runtime_error("fread error"); + in.read(reinterpret_cast(&t), sizeof(t)); } template bool read_off_binary(Surface_mesh& mesh, - FILE* in, + std::istream& in, const bool has_normals, const bool has_texcoords) { @@ -95,7 +93,7 @@ bool read_off_binary(Surface_mesh& mesh, // read vertices: pos [normal] [color] [texcoord] - for (i=0; i& mesh, template bool read_off_ascii(Surface_mesh& mesh, - FILE* in, + std::istream& in, const bool has_normals, const bool has_texcoords) { @@ -150,9 +148,8 @@ bool read_off_ascii(Surface_mesh& mesh, typedef typename K::Vector_3 Texture_coordinate; boost::array buffer; - char line[100], *lp; - unsigned int i, j, items, idx; - int nc; + std::string line; + unsigned int i, j, idx; unsigned int nV, nF, nE; typename Mesh::Vertex_index v; @@ -163,28 +160,29 @@ bool read_off_ascii(Surface_mesh& mesh, if (has_normals) normals = mesh.template add_property_map("v:normal").first; if (has_texcoords) texcoords = mesh.template add_property_map("v:texcoord").first; - int c; + char c; do { - c = getc(in); + c = in.get(); if(c == '#'){ - fgets(line, 100, in); + getline(in,line); } else { - ungetc(c,in); + in.putback(c); break; } }while(1); // #Vertice, #Faces, #Edges - items = fscanf(in, "%d %d %d\n", (int*)&nV, (int*)&nF, (int*)&nE); + in >> nV >> nF >> nE; + getline(in,line); // reads eol mesh.clear(); mesh.reserve(nV, (std::max)(3*nV, nE), nF); // read vertices: pos [normal] [color] [texcoord] - for (i=0; i& mesh, } // position - items = sscanf(lp, "%lf %lf %lf%n", &(buffer[0]), &buffer[1], &buffer[2], &nc); - CGAL_assertion(items==3); + std::istringstream iss(line); + iss >> iformat(buffer[0]) >> iformat(buffer[1]) >> iformat(buffer[2]); v = mesh.add_vertex(Point_3(buffer[0], buffer[1], buffer[2])); - lp += nc; // normal if (has_normals) { - if (sscanf(lp, "%lf %lf %lf%n", &buffer[0], &buffer[1], &buffer[2], &nc) == 3) - { - normals[v] = Vector_3(buffer[0], buffer[1], buffer[2]); - } - lp += nc; + iss >> iformat(buffer[0]) >> iformat(buffer[1]) >> iformat(buffer[2]); } // tex coord if (has_texcoords) { - items = sscanf(lp, "%lf %lf%n", &buffer[0], &buffer[1], &nc); - CGAL_assertion(items == 2); + iss >> iformat(buffer[0]) >> iformat(buffer[1]); texcoords[v] = Vector_3(buffer[0], buffer[1], 0.0); - lp += nc; } } @@ -222,7 +213,7 @@ bool read_off_ascii(Surface_mesh& mesh, for (i=0; i& mesh, } // #vertices - items = sscanf(lp, "%d%n", (int*)&nV, &nc); - CGAL_assertion(items == 1); + std::istringstream iss(line); + iss >> nV; vertices.resize(nV); - lp += nc; // indices for (j=0; j> idx; vertices[j] = typename Mesh::Vertex_index(idx); - lp += nc; } if(!mesh.add_face(vertices).is_valid()) { @@ -249,7 +237,6 @@ bool read_off_ascii(Surface_mesh& mesh, return false; } } - CGAL_USE(items); return true; } } @@ -279,7 +266,7 @@ bool read_off_ascii(Surface_mesh& mesh, template bool read_off(Surface_mesh& mesh, const std::string& filename) { - char line[100]; + std::string line; bool has_texcoords = false; bool has_normals = false; bool has_hcoords = false; @@ -287,25 +274,24 @@ bool read_off(Surface_mesh& mesh, const std::string& filename) bool is_binary = false; // open file (in ASCII mode) - FILE* in = std::fopen(filename.c_str(), "r"); + std::ifstream in(filename.c_str()); if (!in) return false; // read header: [ST][C][N][4][n]OFF BINARY - char *c = std::fgets(line, 100, in); - CGAL_assertion(c != NULL); - c = line; + std::getline(in,line); + const char *c = line.c_str(); if (c[0] == 'S' && c[1] == 'T') { has_texcoords = true; c += 2; } if (c[0] == 'N') { has_normals = true; ++c; } if (c[0] == '4') { has_hcoords = true; ++c; } if (c[0] == 'n') { has_dim = true; ++c; } - if (strncmp(c, "OFF", 3) != 0) { std::fclose(in); return false; } // no OFF + if (strncmp(c, "OFF", 3) != 0) { in.close(); return false; } // no OFF if (strncmp(c+4, "BINARY", 6) == 0) is_binary = true; // homogeneous coords, and vertex dimension != 3 are not supported if (has_hcoords || has_dim) { - std::fclose(in); + in.close(); return false; } @@ -313,10 +299,9 @@ bool read_off(Surface_mesh& mesh, const std::string& filename) // if binary: reopen file in binary mode if (is_binary) { - std::fclose(in); - in = std::fopen(filename.c_str(), "rb"); - c = std::fgets(line, 100, in); - CGAL_assertion(c != NULL); + in.close(); + in.open(filename.c_str(), std::ios::binary); + std::getline(in,line); } // read as ASCII or binary @@ -324,8 +309,7 @@ bool read_off(Surface_mesh& mesh, const std::string& filename) internal::read_off_binary(mesh, in, has_normals, has_texcoords) : internal::read_off_ascii(mesh, in, has_normals, has_texcoords)); - - std::fclose(in); + in.close(); return ok; } diff --git a/Triangulation_3/test/Triangulation_3/test_regular_remove_3.cpp b/Triangulation_3/test/Triangulation_3/test_regular_remove_3.cpp index ca6c3757cb1..06ef052c5eb 100644 --- a/Triangulation_3/test/Triangulation_3/test_regular_remove_3.cpp +++ b/Triangulation_3/test/Triangulation_3/test_regular_remove_3.cpp @@ -343,10 +343,10 @@ int main(int argc, char **argv) boost::int32_t seed0 = 42, seed1 = 43, seed2 = 42, seed3 = 42; // You can also pass seeds on the command line. - if (argc > 1) std::sscanf (argv[1], "%d", &seed0); - if (argc > 2) std::sscanf (argv[2], "%d", &seed1); - if (argc > 3) std::sscanf (argv[3], "%d", &seed2); - if (argc > 4) std::sscanf (argv[4], "%d", &seed3); + if (argc > 1) { std::istringstream iss(argv[1]); iss >>seed0; } + if (argc > 2) { std::istringstream iss(argv[2]); iss >>seed1; } + if (argc > 3) { std::istringstream iss(argv[3]); iss >>seed2; } + if (argc > 4) { std::istringstream iss(argv[4]); iss >>seed3; } Cls T; point_set points; From 68e17df98c14ef14fedd43240c16d5d427d70fb0 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Sat, 3 Mar 2018 19:46:07 +0000 Subject: [PATCH 4/5] test for bad() and not for ! good() --- Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp b/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp index 1fda8219ff4..b2eef25b687 100644 --- a/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp +++ b/Minkowski_sum_2/test/Minkowski_sum_2/test_exact_offset.cpp @@ -82,11 +82,12 @@ int main (int argc, char **argv) read_polygon (argv[i], pgn); // Read the offset radius. - int numer, denom; - char c; + int numer=0, denom = 0; std::istringstream iss(argv[i+1]); + char c; iss >> numer >> c >> denom; - if (! iss.good()) + + if (iss.bad()) { std::cerr << "Invalid radius: " << argv[i+1] << std::endl; return (1); From f91a93d02b4f65a5e9bf100ac2028e026b2603cc Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 6 Mar 2018 15:05:21 +0000 Subject: [PATCH 5/5] Quit VC++ warning concerning a third party lib for reading LAS files --- .../examples/Point_set_processing_3/CMakeLists.txt | 3 +++ Polyhedron/demo/Polyhedron/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt index 1951d62595d..ad21bce96c0 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt @@ -17,6 +17,9 @@ if ( CGAL_FOUND ) # VisualC++ optimization for applications dealing with large data if (MSVC) + # Quit warning in the lasreader + add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS) + if ( CMAKE_SIZEOF_VOID_P EQUAL 4 ) # Allow Windows 32bit applications to use up to 3GB of RAM SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 5cd065b6ffc..68606bd703c 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -298,6 +298,9 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND) include_directories(${LASLIB_INCLUDE_DIR}) include_directories(${LASZIP_INCLUDE_DIR}) add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp) + if (MSVC) + target_compile_definitions( scene_points_with_normal_item PUBLIC "-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS") + endif() target_link_libraries( scene_points_with_normal_item PUBLIC gl_splat ${LASLIB_LIBRARIES}) else() add_item(scene_points_with_normal_item Scene_points_with_normal_item.cpp)